GateAI
Binary Heaps

GATE CSE 2015 Set 2 · Q17

MCQ1 markEasy

Time

Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) (log n)

Binary Heaps

In a complete binary tree where both the left and right subtrees of the root already satisfy the max-heap property, converting the whole tree into a max-heap requires performing a single max-heapify (or sift-down) operation at the root:

  1. The height of a complete binary tree with nn nodes is h=⌊log⁡2n⌋h = \lfloor \log_2 n \rfloor.

  2. In the worst case (e.g., when the value at the root is smaller than all elements in both subtrees), the root element must be sifted down along a path from the root to a leaf node.

  3. The number of level comparisons and swaps along this path is proportional to the tree height hh, requiring Ω(log⁡n)\Omega(\log n) operations.

Hence, the lower bound for the number of operations in the worst case is Ω(log⁡n)\Omega(\log n) (Option A).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Binary Heaps previous year question is Q17 of the GATE CSE 2015 Set 2 paper. Find more GATE CSE PYQs on Binary Heaps in Programming and Data Structures, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Binary Heaps PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Binary Heaps in GATE CSE

Binary Heaps has 15 GATE CSE PYQs across 13 papers from 2011 to 2026. 6 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 2.

How GATE tests Binary Heaps

More from GATE CSE 2015 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2015 Set 2 · Q17 · MCQ

Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.