CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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.

If the root node is at level 0, the level of element X[i], i 0, is

A
log2(i+1)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
log2(i+1)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
log2i
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
log2i
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B log2(i+1)

Index of every node is shown in the box. Floor (log (i + 1)) draw the tree and realise that the last element at each level is the best choice to arrive at a conclusion.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Squaring an Inequality
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon