Quiz — Lecture 17
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. When is early exit WRONG in a scan?
A2. What must every search define for the miss case?
A3. What precondition would make course-finder faster, and what does it cost?
A4. Best vs worst case of a first-match scan?
Section B
B1. Temps [12, 8, 3, -1, -4]: first freeze index and value - and the 'no freeze' answer for [12, 8].
B2. Why is a linear scan optimal for ONE lookup in an unsorted catalogue?
Exit ticket
Answer one of these on your card in 60 seconds (choose any one):
- Cost of a full scan vs early exit, in words.
- What precondition made cs-067 fast?
- Name one search where early exit is wrong.
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.