DSA Pattern Guide
Heaps & Priority Queues Guide
Heaps solve one problem repeatedly in interviews: efficiently tracking the min or max of a changing set without re-sorting. That covers top-K elements, merging K sorted lists, and the two-heap technique for a running median from a data stream — recognize "I need the current smallest/largest, and the set keeps changing" and a heap is usually the answer.
7
Questions in Ediky's DSA-Technical bank
MCQ / trace, not code-judged
Bank
Ediky's code-judged DSA bank doesn't have a dedicated Heap topic yet (only 2 tag mentions) — the 7-question DSA-Technical bank is the real coverage right now.
The patterns that matter
- Top-K problems — a fixed-size heap keeps exactly the K largest/smallest seen so far
- Two-heap technique — a max-heap for the lower half and min-heap for the upper half gives O(log n) running median
- Array-as-heap indexing — parent/child index arithmetic without pointers
- Build-heap in O(n) — why heapifying an array beats inserting one element at a time
Real questions from Ediky's DSA-Technical bank
Actual question titles:
- "Running Median from a Data Stream Using Two Heaps"
- "Build-Heap from `n` Elements: Why O(n), Not O(n log n)?"
- "Min-Heap Indexed as Array: Parent of `arr[i]`"
- "Extract-Max Trace on `[50, 30, 40, 10, 20, 35]`"
Practice Heap questions
7 trace/MCQ questions in Ediky's DSA-Technical bank — sign in to access.
Open Heap questions