Open In App

ISRO | ISRO CS 2014 | Question 28

Like Article
Like
Save
Share
Report

Suppose there are 11 items in sorted order in an array. How many searches are required on the average, if binary search is employed and all searches are successful in finding the item?

(A)

3.00

(B)

3.46

(C)

2.81

(D)

3.33



Answer: (A)

Explanation:

If binary search tree is constructed, for root element one comparison for level 1, two comparisons and so on. There are 1, 2, 4 and 4 elements at levels 1, 2, 3, 4 respectively. So, avg. no of comparisons = (1*1+ 2*2+4*3+4*4)/11 = 3 as for level we need comparisons to reach there.


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


Last Updated : 14 May, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads