Binary search
Previous: Algorithm
Binary search is an algorithm that finds an item in a sorted array in O(log(n)) time complexity. Given no other information other than the array is sorted it is the optimal algorithm for finding the index of an element if it exists, or if it should exist.