cs-079 — The Meeting Triple
| Field | Value |
|---|---|
| id | cs-079 |
| difficulty | Intermediate |
| topics | brute force, combinations |
| lecture | lecture-20 |
| estimated time | 5-minute attempt + 10-minute discussion |
| prerequisites | loops, lists, and tracing from lectures 1-6 |
| objective | choose the technique, trace it faithfully, and defend the boundary behaviour |
| solution | held by the instructor; discussed after the attempt |
Problem
Find three people who can all attend the same slot from availability masks. Enumerate triples systematically and prune; estimate cost honestly.
Your deliverable is the enumerated answer, the space count, and the pruning rule with its measured effect. 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: 4 people, 3 slots; free masks: ada {1,2}, bo {2,3}, cy {1,3}, dee {1,2,3}
- Output: triples with a common slot: {ada,bo,cy} -> none! check: intersection {2}&{3}&{3}... enumerate all 4 triples
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
- C(4,3) = 4 triples; intersect slot sets per triple - tiny space, honest count, systematic order.
- Brute force is a legitimate algorithm when the space is honest about its size.
- Pruning is not cheating; it is arithmetic applied early.
Discussion starter
After the solution is revealed, the class spends five minutes on this prompt: "Which constraint is cheapest to check first, and why does order matter?"
Constraints and assumptions
- Difficulty: Intermediate (loops and lists assumed).
- Topics: brute force, combinations.
- Classroom-scale inputs unless the problem says otherwise.
- Time-box: about five minutes for the plan and trace; finishing the details is a bonus, defending the method is the target.
- Optional stretch (not required): describe an alternative approach and say when it beats the obvious one.
Hints and extension
- First nudge: identify the pattern the worked instance uses before computing anything.
- 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: Bound the candidate space first; then decide whether enumeration is honest.