Question 81

Computer Awareness Searching Medium

The complexity of binary search algorithm is

(A) \( O(n) \)
(B) \( O( \log n) \)
(C) \( O\left(n^2\right) \)
(D) \( O(n \log n) \)
View Dynamic Solution & Explanation
Correct Solution: Option B

Step-by-step Solution:

The binary search algorithm works by repeatedly dividing the search range by half. This leads to a logarithmic time complexity, specifically ( O(\log n) ). \[\] Correct Option: (b)