Stars and Bars
Context: FIT1058_MOC ยท counts unordered selection with replacement ยท items into bins via barriers ยท the hardest cell of the selection framework
Quick Revision
- ๐ฏ Objective: unordered selection with replacement โ nonnegative solutions of .
- ๐ฆ Core Components: stars + bars โ bijection โ .
- โก Key Constraint: reduce with-replacement to without-replacement via an explicit bijection.
๐ Core
1. The Problem
- Definition โ choose from types, repeats allowed, order ignored.
- Equivalent โ nonnegative integer solutions of ().
- Count โ .
2. The Barrier Model
- Stars + bars โ stars, bars; bars split stars into groups .
- Difficulty โ several bars may sit between the same two stars (when ).
3. The Bijection
- Substitute โ โน .
- Effect โ at most one bar per gap โน choose of gaps without replacement.
- Result โ (symmetry).
When It Flips: the key CS move is reducing a new problem to a solved one โ with-replacement โ without-replacement โ by an explicit bijection .
๐ Exam Execution Trace
Manual Execution Trace
, ; solution :
| Step / State | Quantity | Value |
|---|---|---|
| 0 (Init) | โ | โ |
| 1 | stars | 3 |
| 2 | bars | 4 |
| 3 | string |
โ ๏ธ Common Mistakes
- ๐ก With โ without replacement โ without replacement () gives ; allowing changes it to .
๐ง Active Recall
What does count, and what is the stars-and-bars model?
- Hint: Solutions of .
Answer
- Short answer: Unordered selections with replacement of from types; stars, bars splitting into groups.
- Why: Each arrangement โ one selection .
Why introduce , and how does it yield ?
- Hint: Reduce to without-replacement.
Answer
- Short answer: makes the sum with every group nonempty โน at most one bar per gap.
- Why: Bijection โ choosing of gaps without replacement gives .