Case-based lecture: you attempt, we discuss, then we reveal.
cs-101, cs-102, cs-103, cs-137, cs-104Sample: 8 first-years (avg mood 6), 2 third-years (avg mood 8). Overall average mood - naive or weighted, and which is right?
m1, n1 = 6.0, 8
m2, n2 = 8.0, 2
pooled = (n1 * m1 + n2 * m2) / (n1 + n2)
weighted = (m1 + m2) / 2
print(round(pooled, 2), round(weighted, 2))Expected: pooled mean 6.4 (per respondent); cohort-balanced 7.0 (per cohort)
Cost: O(1) - the difficulty is conceptual, not computational.
Minutes-late over 14 days: 2, 0, 5, 3, 0, 7, 4, 1, 2, 6, 3, 0, 9, 2. Build the frequency table. Is 'usually less than 3 minutes late' a fair claim?
delays = [2, 0, 5, 3, 0, 7, 4, 1, 2, 6, 3, 0, 9, 2]
freq = {}
for d in delays:
freq[d] = freq.get(d, 0) + 1
under3 = sum(c for d, c in freq.items() if d < 3)
print(under3, len(delays), f"{under3 / len(delays):.0%}")Expected: 7 of 14 days under 3 minutes - 50%, not 'usually'
Cost: O(n) tally + O(u) report; the histogram is one of the cheapest, most honest tools in the kit.
Of 100 sessions: 40 were mobile, and 10 sessions double-clicked. 8 of the double-clicks were mobile. P(mobile | double-click) vs P(double-click | mobile) - compute both, and why do they differ?
overlap, n_double, n_mobile = 8, 10, 40
p_m_given_d = overlap / n_double
p_d_given_m = overlap / n_mobile
print(round(p_m_given_d, 2), round(p_d_given_m, 2))Expected: P(mobile | double-click) = 0.8; P(double-click | mobile) = 0.2
Cost: O(1) after the table exists; building the 2x2 from raw events is O(n).
From two weeks of bus logs, estimate the probability of a late arrival, and of two lates in a row (testing independence empirically).
**Input:** 14 days, 4 late -> 4/14; two consecutive lates occurred once in 13 possible pairs**Output:** P(late) ~ 0.286; P(late twice in a row) ~ 1/13 ~ 0.077 vs P(late)^2 ~ 0.082 - close: near-independenceSolve for the worked instance first. Then ask what would change if onenumber, name, or condition were replaced by something stranger.Pseudocode, flowchart or Python. State one assumption. Compare with your neighbour at minute 4.
Instructor: the reveal, the reasoning section and common wrong turns are in the instructor distribution for cs-101 — not embedded in this deck.
If 4% of clicks are accidental and 10% of clicks are on ads, what's the range for both-at-once? Bounds without independence; exact value with it.
**Input:** P(accidental) = 0.04, P(ad click) = 0.10**Output:** P(both) is between max(0, 0.04+0.10-1)=0 and min(0.04, 0.10)=0.04; with independence: 0.004Solve for the worked instance first. Then ask what would change if onenumber, name, or condition were replaced by something stranger.Pseudocode, flowchart or Python. State one assumption. Compare with your neighbour at minute 4.
Instructor: the reveal, the reasoning section and common wrong turns are in the instructor distribution for cs-102 — not embedded in this deck.
A rare-condition flagger: 99% accurate, 1-in-1000 prevalence. Compute the chance a flagged person actually has it. The counterintuitive base-rate classic.
**Input:** prevalence 1/1000; flagger: sensitivity 99%, false-positive rate 1%**Output:** P(condition | flagged) = 0.99*0.001 / (0.99*0.001 + 0.01*0.999) ~ 9.0%Solve for the worked instance first. Then ask what would change if onenumber, name, or condition were replaced by something stranger.Pseudocode, flowchart or Python. State one assumption. Compare with your neighbour at minute 4.
Instructor: the reveal, the reasoning section and common wrong turns are in the instructor distribution for cs-103 — not embedded in this deck.
A lab server must back up 500 GB every night inside a one-hour window. Two designs are on the table; all failure probabilities are **stated assumptions about this lab's hardware**, not measurements:
**Input:** the two plans with their failure probabilities and costs**Output:** plan A: clean night 0.900, expected waste 5.0 min — planB: clean night 0.904, expected waste 1.0 min — plus recommendationSolve for the worked instance first. Then ask what would change if onePseudocode, flowchart or Python. State one assumption. Compare with your neighbour at minute 4.
Instructor: the reveal, the reasoning section and common wrong turns are in the instructor distribution for cs-137 — not embedded in this deck.
How likely is a 5-win streak in a 20-game season at 55% win probability? Exact recursion vs Monte Carlo; compare and explain differences.
**Input:** 20 games, win prob 0.55, ask P(streak of 5 wins somewhere)**Output:** exact recursion vs Monte Carlo (100k seasons) agree to ~2 decimal placesSolve for the worked instance first. Then ask what would change if onenumber, name, or condition were replaced by something stranger.Pseudocode, flowchart or Python. State one assumption. Compare with your neighbour at minute 4.
Instructor: the reveal, the reasoning section and common wrong turns are in the instructor distribution for cs-104 — not embedded in this deck.