StudyGraph
Algorithms & Complexity It is like…

Binary search is a phone book trick

Binary search is like finding a name in a phone book

Lesson notes

Key points

Takeaway: Binary search halves a sorted range each step: O(log n).

Quick check: What must be true of an array before binary search works on it?
  1. It must be sorted
  2. It must have even length
  3. It must hold no duplicates

Discarding half only works if order tells you which half the target is in.

Phone bookThe mappingWhere it breaks

Lessons like this, for your syllabus.

Short narrated study videos written for your course, level and exam. Free to start.

Get lessons for your own syllabus