A generic priority queue for Python

后端 未结 12 467
面向向阳花
面向向阳花 2020-12-13 03:27

I need to use a priority queue in my Python code, and:

  • am looking for any fast implementations for priority queues
  • optimally, I\'d li
12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 04:24

    Did you look at the "Show Source" link on the heapq page? There's an example a little less than halfway down of using a heap with a list of (int, char) tuples as a priority queue.

提交回复
热议问题