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.
Glossary: Data Structures and Algorithms
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.