Skip to content
CCC Python Course

Binary search

Stage
5
Module
M5.5
Lessons
1

In this module

  • Use bisect_left and bisect_right to find insertion points in sorted arrays.
  • Implement binary search on the answer over a monotone predicate.
  • Maintain correct loop invariants and avoid off-by-one errors.

Before this module

Lessons

  1. 1Binary search fundamentals

Practice

Try this on the judge. The link opens the problem on WMOJ.

  1. 2021 S3
    Lunch Concert (opens on WMOJ in a new tab) WMOJ

    Find the concert with the best time match using binary search on sorted data.