🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Heaps and Heap Sort Internals: all 15 questions

Quiz: Heaps and Heap Sort Internals · Question 4 of 15

A new value is pushed onto a min-heap. Where is it placed first, and which way does it move?

A new value is pushed onto a min-heap. Where is it placed first, and which way does it move?

  1. A.At the root, then it sifts down
  2. B.In sorted position, by binary search
  3. C.At the end of the array, then it sifts up while it is smaller than its parent
  4. D.At the end, and it never moves
Answer & explanation

Correct answer: At the end of the array, then it sifts up while it is smaller than its parent

Adding at the end keeps the tree complete; sifting up restores the parent ≤ child rule in O(log n).

Can you get the rest right without peeking?

Take the timed Quiz: Heaps and Heap Sort Internals quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →