MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A binary search is to be performed on the list:3 5 9 10 23How many comparisons would it take to find number 9?
A
0-1
B
2-3
C
4-5
D
I can’t find the number 9
Explanation: 

Detailed explanation-1: -The maximum number of comparisons is logarithmic with respect to the number of items in the list. Therefore, the binary search is O(log n) .

Detailed explanation-2: -A binary search of 10, 000 items requires at most 14 comparisons. Thus, in terms of the number of comparisons, binary search is much more efficient than sequential search. However, in order to use the binary search approach, the items must be presorted.

There is 1 question to complete.