GATE CS 2001 · Arrays & Matrix Representation

MCQ · 1 mark · Problem PROG-DSTR-0273

Consider any array representation of an n element binary heap where the elements are stored from index 1 to index n of the array. For the element stored at index i of the array (\(i\leq n\) ) , the index of the parent is
  1. A
    i-1
  2. B
    \(\left \lfloor \frac{i}{2} \right \rfloor\)
  3. C
    \(\frac{i}{2}\)
  4. D
    \(\frac{(i+1)}{2}\)

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option B.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/708/gate2001-1-15

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com