What is the maximum running time of binary search algorithm, when n = 12,000?
Show answerHide answer
Correct answer: (C) 14
Explanation
Binary search needs at most ⌊log₂n⌋ + 1 comparisons. 2¹³ = 8192 ≤ 12000 < 16384 = 2¹⁴, so ⌊log₂12000⌋ = 13 and the maximum is 14.