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

PYQ Cognizant GenC 2024

Consider an 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 (1 < i <= n), the index of the parent is:

  1. A.

    floor ((i-1)/2)

  2. B.

    ceiling ((i+1)/2)

  3. C.

    floor (i/2)

  4. D.

    ceiling (i/2)

Attempted by 95 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…