Skip to content

Glossary: Data Structures and Algorithms in Rust

Binary search

Also written: binary_search

Finding an item in a sorted list by checking the middle and discarding the half that can't hold the target. It takes O(log n) steps, at most 20 for a million items. Rust's slice method binary_search returns Ok(index) or Err(index).

Where the book teaches it

Related terms

Off-by-one errorpartition_pointOption