An array X of n distinct integers is interpreted as a complete binary tree. If…

GATE · 2006 · IT

An array X of n distinct integers is interpreted as a complete binary tree. If the first array index is 0, what is the parent index of element X[i] for i ≠ 0?

  1. A.

    ⌊i / 2⌋

  2. B.

    ⌈(i - 1) / 2⌉

  3. C.

    ⌈i / 2⌉

  4. D.

    ⌈i / 2⌉ - 1

Attempted by 566 students.

Show answer

Correct answer: D

The worked solution is available to enrolled students.

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

Loading lesson…