GATE CS 2026 Set 1 — Question 23
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MSQ+1 / -0MediumMin-Heap & Max-HeapHeapsProgramming & Data Structures
Programming & Data Structures → Heaps → Min-Heap & Max-Heap
Last updated
Question
Let be an odd number greater than 100. Consider a binary minheap with elements stored in an array whose index starts from 1.Which of the following indices of do/does NOT correspond to any leaf node of the minheap?
Correct answer
(B) (n-1)/(2); (C) (n-3)/(2)
Solution
In a binary heap with nodes stored in a 1-indexed array:
So, the internal nodes are at indices to .
The leaf nodes are at indices to .Let's check the options:
(A) : This is the first leaf node index. It corresponds to a leaf.
(B) : This is the last internal node index. It does NOT correspond to a leaf.
(C) : Since , this index is valid and less than . Thus, it is an internal node. It does NOT correspond to a leaf.
(D) : This is the last leaf node index. It corresponds to a leaf.The question asks for indices that do NOT correspond to any leaf node. Therefore, (B) and (C) are correct.
- The internal nodes are located at indices .
- The leaf nodes are located at indices .
So, the internal nodes are at indices to .
The leaf nodes are at indices to .Let's check the options:
(A) : This is the first leaf node index. It corresponds to a leaf.
(B) : This is the last internal node index. It does NOT correspond to a leaf.
(C) : Since , this index is valid and less than . Thus, it is an internal node. It does NOT correspond to a leaf.
(D) : This is the last leaf node index. It corresponds to a leaf.The question asks for indices that do NOT correspond to any leaf node. Therefore, (B) and (C) are correct.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Heaps
2026 Set 2 Q12The set T represents various traversals over binary tree. The set S represents the order of…2026 Set 2 Q19Consider the following three ANSI-C programs, P1, P2, and P3. P1 [code] P2 [code] **P3**…2026 Set 1 Q24Consider a hash table that is initially empty. The hash table is maintained…2026 Set 1 Q27Consider the following C statements: Which of the following options is/are correct? [figure]2026 Set 2 Q30The keys 5, 28, 19, 15, 26, 33, 12, 17, 10 are inserted into a hash table using the hash function…