What happens in one round of binary search?
- Check every item in turn
- Compare the middle, then drop the dead half
- Shuffle the list and retry
Binary search needs its data sorted.
Circle one: True False
Each comparison wipes out about half of the suspects left.
Circle one: True False
Why does halving fail on jumbled data?
- Jumbled lists cannot be read
- Comparisons stop working
- The dropped half might hide the target
Hunting 57 in sorted 3, 37, 45, 57, 93 and 120, the middle reads 45. Which half survives?
- The upper half holding 57, 93 and 120
- The lower half holding 3, 37 and 45
- Both halves stay in play
When is the sorting cost worth paying?
- When only one hunt is planned
- When many hunts will follow
- When the list keeps shrinking
A thousand sorted items face one hunt by each method. What best compares them?
- About ten halvings against up to a thousand checks
- Ten checks each either way
- A thousand checks each either way
A friend runs binary search on unsorted scores and trusts the miss. What do you say?
- Trust it, since halving never fails
- Add more items and retry
- Sort first, since a miss on jumbled data proves nothing