What is the time complexity of the binary search algorithm?

1 Answers
Answered by suresh

Time Complexity of Binary Search Algorithm

Time Complexity of Binary Search Algorithm

The time complexity of the binary search algorithm is O(log n), where n is the number of elements in the sorted array being searched. This is because in each step of the algorithm, the search space is effectively halved, resulting in a logarithmic time complexity.

Answer for Question: What is the time complexity of the binary search algorithm?