a guest Oct 20th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- """Module containing a priority queue implemented as a binary heap with a
- fast heapify method.
- from basic_priority_queue import BasicPriorityQueue
- class FastPriorityQueue(BasicPriorityQueue):
- """Implementation of a binary max-heap based priority queue fast heapify."""
- def _heapify(self):
- """Converts the list to heap order. On average it uses
- considerably fewer comparisons than inserting each item
- index = len(self._items)
- for index in range(1, len(self)):
RAW Paste Data