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

What is the time to pop the smallest item from a binary heap of n items?

What is the time to pop the smallest item from a binary heap of n items?

  1. A.O(1)
  2. B.O(n)
  3. C.O(log n)
  4. D.O(n log n)
Answer & explanation

Correct answer: O(log n)

The last item moves to the root and sifts down, at most one level per step, and the height is about 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 →