Binary search · 2 of 3
Sorted arrays
Use the library's lower and upper bound for membership, counts and runs of equal values, then halve a rotated array and an array with peaks, which are not sorted.
Books1
Links2
- bisect: Array bisection algorithm bisect_left, bisect_right and their key argument, with recipes for lookups such as the leftmost value equal to x. docs.python.org (opens in a new tab)
- std::lower_bound What lower_bound requires of the range, what it returns, and links to upper_bound and equal_range. en.cppreference.com (opens in a new tab)