Data structures · Heaps and priority queues

Heaps in Python

Python's heapq module does the sifting for you on an ordinary list, and a heap of a few items can watch a stream of millions.