cs-142 — The Tallied Vote
| Field | Value |
|---|---|
| id | cs-142 |
| difficulty | Beginner |
| topics | aggregation, communication, data |
| lecture | lecture-09 |
| estimated time | 5-minute attempt + 10-minute discussion |
| prerequisites | none |
| objective | tally a small ballot exactly and report the result without over-claiming |
| solution | held by the instructor; discussed after the attempt |
Problem
Eleven committee members each wrote one name on a slip:
Zoe Amir Zoe Bea Amir Cal Zoe
Bea Cal Amir Zoe
Your deliverables:
- The tally per candidate.
- The winner (most slips) and the runner-up.
- The share of slips for the top two, as percentages of the valid ballots, to one decimal place.
- The one-sentence announcement to the committee that reports the result without over-claiming (what does 11 slips NOT tell you?).
If the problem is ambiguous anywhere, state the assumption you are making and carry on — a stated assumption is part of a good answer.
Examples
- Input: the eleven slips
- Output: Zoe 4, Amir 3, Bea 2, Cal 2 — winner Zoe 36.4%, runner-up Amir 27.3% — one honest sentence
Solve for the worked instance first. Then ask what would change if one number, name, or condition were replaced by something stranger.
What to notice
- Counting is easy; not over-claiming is the skill. Eleven slips cannot say what the twelfth member or the absentees would have done.
- Percentages must name their base: 4 of 11 valid ballots is not "40%".
- A winner under this rule is defined by the rule (most slips); had the rule required a majority (>50%), the same slips give a different outcome — the rule is part of the result.
Discussion starter
After the solution is revealed, the class spends five minutes on this prompt: "The committee chair asks you to announce 'Zoe wins by a landslide.' Redraft the sentence so it stays true with the same numbers."
Constraints and assumptions
- Difficulty: Beginner (no prior experience assumed).
- Topics: aggregation, communication, data.
- All eleven slips are valid; none is blank or double-named.
- Classroom-scale inputs unless the problem says otherwise.
- Time-box: about five minutes for a first attempt; partial answers with clear reasoning are worth more than silent struggling.
- Optional stretch (not required): describe an alternative approach and say when it beats the obvious one.
Hints and extension
- First nudge: count in one pass, keeping one running number per name.
- If stuck after three minutes, write the input/output line you expect and trace the smallest example by hand.
- After the reveal, attempt the extension below before the next lecture.
- Extension challenge: the chair proposes a two-round runoff between the top two, with Bea's and Cal's slips redistributed by each slip's second choice — explain what information the ballots lack for that, and why.