Consider a sorted array of 10,00,000 elements. What is the maximum number of comparison required to find the location an item using binary search?
Show answerHide answer
Correct answer: (A) 20
Explanation
Binary search needs at most ⌈log₂(n+1)⌉ comparisons. 2²⁰ = 1,048,576 ≥ 10,00,000, so the maximum is 20.