Consider any array representation of an n element binary heap where the…

GATE · 2001 · CS · Question 1 subparts

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 <= n), the index of the parent is

  1. A.

    i − 1

  2. B.

    floor(i/2)

  3. C.

    ceiling(i/2)

  4. D.

    (i + 1)/2

Attempted by 183 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…