Consider a 1-based array representation of an n-element binary heap, where…
GATE · Computer Science · 2001
Consider a 1-based array representation of an n-element binary heap, where elements are stored from index 1 to index n. For a non-root element stored at index i (1 < i <= n), the index of its parent is:
- A.
i - 1
- B.
⌊i / 2⌋
- C.
⌈i / 2⌉
- D.
(i + 1) / 2
Attempted by 295 students.
Show answer
Correct answer: B
Explore the full course: Iocl Engineers Officers Grade A Paper 2
Loading lesson…