Question DSA-CX-0001
EasyWhat is the worst-case time complexity of binary search on a sorted array of n elements?
- A.
O(1)
- B.
O(log n)
- C.
Show answer and explanation
Answer: B
Each comparison halves the search range, so at most comparisons are needed: .