What happens in one round of binary search?
- Check the first item, then drop it and move on
- 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
- The middle item cannot be found without order
- The dropped half might hide the target
Hunting 12 in sorted 2, 5, 12, 18, 25, 31 and 40, the middle reads 18. Which part stays in play?
- The lower part: 2, 5 and 12
- The upper part: 25, 31 and 40
- Both parts 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
Four thousand sorted items face one hunt by each method. What best compares them?
- About 12 halvings against up to 4,000 checks
- About 2,000 halvings against up to 4,000 checks
- 4,000 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