Data Structures19 sections · 729 units
Open in Course

Quiz: Two Heaps

Insertion order

Check Your Understanding

In the two-heaps median solution, why do we always add to max-heap first, then transfer to min-heap?

  1. A.To make the code simpler
  2. B.Because max-heap is for larger elements
  3. C.To ensure the element ends up in the correct heap through comparison with max-heap root
  4. D.It doesn't matter which heap we add to first
Start the roadmap to answer the quizzes and solve the challenges