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 / StateQuantityValue
0 (Init)โ€”โ€”
1stars 3
2bars 4
3string

โš ๏ธ Common Mistakes

  • ๐Ÿ’ก With โ‰  without replacement โž” without replacement () gives ; allowing changes it to .

๐Ÿง  Active Recall