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):

  1. State cs-074's invariant in one sentence.
  1. Why do two pointers give linear cost?
  1. What ends the slow/fast walk's doubt?

Homework