Glossary: Coding Interviews in C++
Heap
Also written: min-heap, max-heap, priority queue
A structure that always gives you the biggest (max-heap) or smallest (min-heap) item quickly. Keeping a heap of only k items finds the top k in O(n log k).
Glossary: Coding Interviews in C++
Also written: min-heap, max-heap, priority queue
A structure that always gives you the biggest (max-heap) or smallest (min-heap) item quickly. Keeping a heap of only k items finds the top k in O(n log k).