Binary search · 1 of 3
Binary search technique
Find a value in a sorted array by halving the range, then find the first position where a yes-or-no question changes from NO to YES.
- Binary search The same search written with a loop invariant in which the left end is a NO and the right end is a YES, then the lower and upper bound and search over real numbers. cp-algorithms.com (opens in a new tab)
- Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken How (low + high) / 2 overflowed in the Java library, and the midpoint forms that avoid it. research.google (opens in a new tab)