Quiz — Lecture 09
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. Name the four aggregation patterns.
A2. Why initialise best-so-far from the first element, not 0?
A3. Where is the average computed, and why there?
A4. What does one-pass mean, and what would two passes cost?
Section B
B1. Pages [12, 0, 25, 8, 30], target 10: give total, average, best day, days below target.
B2. Stock levels [4, 9, 9, 2]: report the argmax with a witness (its index), stating your tie rule.
Exit ticket
Answer one of these on your card in 60 seconds (choose any one):
- Name the aggregation pattern for 'which day had the most sales'.
- Why reset streak state?
- What is two-pass thinking and when does it pay?
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.