Question
Let be an odd number greater than . Consider a binary minheap with elements stored in an array whose index starts from .
Which of the following indices of do/does NOT correspond to any leaf node of the minheap?
Official answer and solution
- Official answer
- B and C
- From
- Official GATE 2026 answer key
Solution
Use the 1-indexed binary heap property that internal (non-leaf) nodes occupy indices through .
In a 1-indexed binary heap with elements, node has left child and right child . Thus node is a non-leaf (internal) node if and only if , i.e., , while leaf nodes occupy indices through .
Since is odd, . Therefore:
- and are , so they correspond to non-leaf nodes.
- and are , so they correspond to leaf nodes.
Options (B), (C)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2026 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 23 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.