Quiz — Lecture 21
Section A from memory, one line each. Section B shows your reasoning - marks are for method, not final answers. Answers are discussed in class; the exit ticket goes on a card.
Section A
A1. What precondition does binary search need?
A2. Write the loop invariant.
A3. What does (lo + hi) // 2 do at even widths?
A4. Probes for a million items: about how many?
Section B
B1. First bad version among 1..10, bad from 7: list the probes.
B2. Why start the cap search at max(pages), not 0?
Exit ticket
Answer one of these on your card in 60 seconds (choose any one):
- Why must the predicate be monotone for binary search?
- What is searched in search-on-the-answer?
- How many halvings for 1,000,000?
Homework
- Before: skim the four student pages; attempt case 1 on paper.
- After: write a five-line pseudocode solution for any case you did not
- Enrichment (optional): the stretch question on each case page.