Gate CS-2001 Question Paper With Solutions

Q. 15 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 (i<= n), the index of the parent is:

(A) floor((i+1)/2)

(B) ceiling((i+1)/2)

(C) floor(i/2)

(D) ceiling(i/2)

Answer: (C)

Explanation:

Learn More:   Gate CS-2015-1 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here