Multiple choice

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. $i-1$
  2. $\lfloor \frac{i}{2} \rfloor$
  3. $\lceil \frac{i}{2} \rceil$
  4. $\frac{(i+1)}{2}$
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation