Faster function for top n elements in a dictionaty than heapq.nlargest()

后端 未结 0 1766
逝去的感伤
逝去的感伤 2021-02-19 11:29

For finding the top n elements of a dictionary we use top_n = heapq.nlargest(). This returns sorted list as an answer. Is there a more optimal way to achieve this

相关标签:
回答
  • 消灭零回复
提交回复
热议问题