Use this tag for code that implements a binary search.

Binary search is an efficient algorithm for finding a key in sorted data. It runs in O(log n) time.

The binary search algorithm begins by comparing the target value to value of the middle element of the sorted array. If the target value is equal to the middle element's value, the position is returned. If the target value is smaller, the search continues on the lower half of the array, or if the target value is larger, the search continues on the upper half of the array. This process continues until the element is found and its position is returned, or there are no more elements left to search for in the array and a "not found" indicator is returned.