Open In App

GATE | GATE IT 2006 | Question 71

Like Article
Like
Save
Share
Report

An array X of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is 0. The index of the parent of element X[i],i≠0 is?
(A) lowerbound[i/2]
(B) upperbound[(i-1)/2]
(C) upperbound[i/2]
(D) upperbound[i/2] -1


Answer: (D)

Explanation: left child of ith element will be at 2*i+1 and right child at 2(i+1)

Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads