← Heaps & Priority Queues Quiz: all 8 questions
Heaps & Priority Queues Quiz · Question 7 of 8
For the running median (Find Median from Data Stream), which structure is standard?
For the running median (Find Median from Data Stream), which structure is standard?
- A.One sorted array
- B.A max-heap for the smaller half and a min-heap for the larger half
- C.A single min-heap
- D.A hash map
Answer & explanation
Correct answer: A max-heap for the smaller half and a min-heap for the larger half
The two tops sit right at the middle, giving O(log n) inserts and O(1) median queries.
Can you get the rest right without peeking?
Take the timed Heaps & Priority Queues Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →