Quiz — Lecture 13

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 a dictionary the right structure rather than a list?

A2. What does tally.get(w, 0) do?

A3. Which set operation answers 'in both rosters'?

A4. What is the cost of x in some_list vs x in some_set?

Section B

B1. Tally 'mississippi': give the dictionary and the two most frequent letters with a tie rule.

B2. CS = {ada, bo}, DS = {bo, cy}: express and compute 'exactly one course'.

Exit ticket

Answer one of these on your card in 60 seconds (choose any one):

  1. When do you choose a dictionary over a list?
  1. What single operation do sets make O(1)-ish and lists O(n)?
  1. Restate the consensus rule of cs-052 precisely.

Homework