Skip to content

Glossary: Algorithms Beyond the Basics

heapq

Also written: heappush, heappop

Python's standard-library module for heaps. `heappush` adds an item and `heappop` removes the smallest in O(log n).

Where the book teaches it

Related terms

Min-heapDijkstra's algorithm