Skip to content

Glossary: Data Structures and Algorithms

Max-heap

Also written: max-heap trick

A heap that gives the largest item first. Since `heapq` only makes min-heaps, you push negative priorities and negate them again after popping.

Where the book teaches it

Related terms

Heapheapq