Quiz — Lecture 19
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. Define invariant (in one sentence).
A2. What are the two-pointer movement rules' jobs?
A3. Why does pair-sum need sorted input?
A4. When do the pointers stop?
Section B
B1. Walk 'Level' with two pointers: list the comparisons.
B2. State the invariant for partition-by-parity and the swap rule.
Exit ticket
Answer one of these on your card in 60 seconds (choose any one):
- State cs-074's invariant in one sentence.
- Why do two pointers give linear cost?
- What ends the slow/fast walk's doubt?
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.