Britannica Sources used in this answer

Why does binary search have logarithmic time complexity?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

Binary search is classified as having logarithmic time complexity, denoted as O(logn), because of how it processes data. Rather than examining each element individually, a binary search on a sorted list repeatedly divides the search space in half until the target element is located.1

Because the algorithm discards half of the remaining elements with each step, the number of operations required to find the target grows according to the logarithm of the input size n (specifically in base 2), rather than growing proportionally to n as in linear time algorithms. This logarithmic growth rate makes binary search significantly more efficient than linear search as the number of elements increases.1