Data structures · Heaps and priority queues
A priority queue is a few dozen lines of Python once the two sifts are right, and you type every one of them here.