The complexity of Binary Search Algorithm is expressed as:
2026
The complexity of Binary Search Algorithm is expressed as:
- A.
O(loge n)
- B.
O (n2)
- C.
O(log2 n)
- D.
O (n)
Attempted by 211 students.
Show answer & explanation
Correct answer: C
The Binary Search Algorithm has a time complexity of O(log₂ n). This is because the algorithm repeatedly divides the search space in half with each iteration. Starting with a sorted array of size n, after k iterations, the remaining search space is n / 2^k. The algorithm terminates when the search space reduces to 1, meaning 2^k = n, or k = log₂ n.