Skip to content
GATEiit

GATE CSE 2026 Session 1 Q23: Non-leaf indices in a 1-indexed binary heap with n odd

Question

Let nn be an odd number greater than 100. Consider a binary minheap with nn elements stored in an array PP whose index starts from 1.

Which of the following indices of PP do/does NOT correspond to any leaf node of the minheap?

Try it: multiple select: one or more correct options

Select one or more options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation

Answer: B, C (official GATE 2026 final answer key)

Concept used: In a 1-indexed heap, node ii has children 2i2i and 2i+12i+1; internal nodes are 11 to ⌊n/2⌋\lfloor n/2 \rfloor.

First step: For odd nn, ⌊n/2⌋=(n−1)/2\lfloor n/2 \rfloor = (n-1)/2; indices up to that are internal.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2026 Session 1 CS question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key