passdrill
School · Coding & Computers · Card 005/010 medium

You're looking for a name in a printed phone book with 1,000 sorted pages. Which strategy finds it in far fewer steps: checking every page one by one from the start, or repeatedly opening to the middle of the remaining pages and deciding which half to search next?

  1. Opening the middle page each time and eliminating half the remaining pages at every step, because the pages are already sorted alphabetically, quickly narrows down where the name must be
  2. Checking every page one by one, because binary search only saves time when you already know exactly which page the name is on
  3. Opening the middle page each time, because splitting a list in half always cuts the work equally, whether or not the pages are sorted
  4. Checking every page one by one, because with only 1,000 pages, one-by-one checking and middle-splitting take roughly the same number of steps overall
Next card → Shuffle