🎙 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 5 of 15

During sift down in a min-heap, the node is swapped with:

During sift down in a min-heap, the node is swapped with:

  1. A.the smaller of its two children, if that child is smaller than the node
  2. B.the left child always
  3. C.the larger of its two children
  4. D.its parent
Answer & explanation

Correct answer: the smaller of its two children, if that child is smaller than the node

Swapping with the smaller child makes that child a valid parent of the other one.

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 →