Module M17 · 17 of 35 in teaching order · Intermediate

Binary Search Patterns

Boundaries, lower and upper bounds, and searching over a monotonic predicate.

Lessons

  1. Binary search over possible answers instead of array indices: find the first true of a monotonic predicate, with a minimum-capacity example in four languages.

Topics this module covers

The full module scope. Topics without a lesson above are not written yet.

  • boundaries
  • lower/upper bound
  • first/last occurrence
  • rotated arrays
  • search on answer
  • monotonic predicates
  • peak
  • matrix
  • edge cases

Builds toward