The GATE Grind

GATE 2015 CS (CS2) – Question 22

Programming and Data Structures · Binary Heaps · 1 mark · Multiple choice

A complete binary tree has max-heaps as the left and right subtrees of its root. Which lower bound describes operations to convert the whole tree to a heap in the worst case?

  1. $\Omega(\log n)$
  2. $\Omega(n)$
  3. $\Omega(n\log n)$
  4. $\Omega(n^2)$

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) $\Omega(\log n)$

Explanation

Only the root may violate the heap property. Sifting it down repairs the tree; in the worst case it travels to a deepest leaf, taking one step per level. A complete tree has Θ(log n) height, so the tight worst-case lower bound among the options is Ω(log n), A.

More Binary Heaps questions

All Binary Heaps questions →