Binary search halves the search space at each step by comparing the target with the midpoint. Beyond simple array search, binary search applies to answer-space problems (binary search on answer), rotated arrays, peak finding, and lower/upper bound queries. It is a building block for more complex algorithms.
The 5-Mode Loop
5 of 5 modes available
Read · See · Animate · Test · Build