Question:medium

What is the time complexity of a binary search algorithm on a sorted array?

Show Hint

Binary search efficiently narrows down the search space by half each time, leading to a time complexity of O(log n).
Updated On: Jan 16, 2026
  • O(n)
  • O(log n)
  • O(n log n)
  • O(n²)
Show Solution

The Correct Option is B

Solution and Explanation

The time complexity of binary search is O(log n), with 'n' representing the array's element count. This logarithmic complexity arises from repeatedly halving the search interval, efficiently discarding half of the remaining elements per step, which is superior to linear search's O(n).
- Linear search, which examines each element, has a time complexity of O(n) (A).
- Algorithms combining a linear pass with a logarithmic operation, like merge sort, typically exhibit O(n log n) (C) complexity.
- Algorithms employing nested iterations, such as bubble sort, have a time complexity of O(n²) (D).
Therefore, O(log n), option (B), correctly identifies the time complexity of binary search.
Was this answer helpful?
0