// TOPIC
#priority-queues
2 articles
◆◆IntermediateAmazonGoogle
01Heaps and Priority Queues
Learn how the heap data structure delivers O(1) peek and O(log n) push and pop — the engine behind priority queues, top-K queries, and K-way merges.
#heaps#trees#priority-queues
11 min◆◆IntermediateAmazonGoogle
02The Top-K Elements Pattern
How a heap of size k gives you the k largest (or smallest, or most frequent) items in O(n log k) — and why a min-heap is the counterintuitive tool for finding the biggest things.
#heaps#priority-queues#hash-maps
13 min