Advanced Counting
121 words
1 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Advanced Counting ## Stars and Bars (Combinations with Repetition) Number of ways to distribute $n$ identical objects into $k$ distinct boxes: $$ \binom{n + k - 1}{k - 1} $$ **Example:** Number of solutions to $x_1 + x_2 + x_3 = 10$ with $x_i \geq 0$ integers: $\binom{10+3-1}{3-1} = \binom{12}{2} = 66$. ## Multino...

Advanced Counting
Stars and Bars (Combinations with Repetition)
Number of ways to distribute n identical objects into k distinct boxes:
Example: Number of solutions to x1+x2+x3=10 with xi≥0 integers: (3−110+3−1)=(212)=66.
Multinomial Coefficients
(n1,n2,…,nkn)=n1!n2!⋯nk!n!Derangements
A derangement is a permutation with no fixed points. Number of derangements of n items:
D4=9, D5=44, D6=265.
Catalan Numbers
Cn=n+11(n2n)Counts: balanced parentheses, binary trees, Dyck paths, etc.
Join Discord
PreviousCounting PrinciplesNextAdvanced Permutations