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

后端 未结 0 494
猫巷女王i
猫巷女王i 2021-02-19 11:24

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

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