Sobes.tech
Junior

What is the time complexity of binary search algorithm?

sobes.tech AI

Answer from AI

$O(\log n)$.

Binary search divides the remaining range in half at each iteration, thereby reducing the number of elements to check by a factor of two. This results in a logarithmic dependence of execution time on the size of the input data ($n$).