最佳答案
在 python 中有一个内置的 heapq算法,它提供了 push、 pop、 nlargest、 nsmallest... 等可以应用于列表的算法。然而,还有一个 queue.PriorityQueue类似乎支持多少相同的功能。有什么区别,什么时候你会用一个而不是另一个?