// TOPIC
#heaps
2 articles
◆◆IntermediateAmazonGoogle
01Heaps and Priority Queues
The heap data structure gives you O(1) peek at the min (or max) and O(log n) insert and extract — the exact shape you need for scheduling, K-way merging, and the top-K pattern that shows up everywhere in systems interviews.
#heaps#trees#priority-queues
10 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
11 min