Permutations and Combinations

Permutations of \(n\) distinct items

This is a common job & internship interview question! See Section 6.6 of your textbook for an algorithm that generates permutations in a lexicographic order. The algorithm is very space efficient. In fact, the algorithm that I use here is that one.

Permute items. Use a small number \(\le 5\).

Select \(r\) indistinguishable objects from \(n\) types with repetition

This corresponds to Section 6.5.3 of the textbook (\(8^{th}\) ed.), and may help with visualizing why the number of distinct ways of taking \(r\) items, out of of \(n\) different items each of which is available in unlimited supply is \[C(n + r - 1, r)\]
\(CWR(n,r) =\) CWR(,), or select \(r\) things from \(n\) bins with repetition. Use \(n \le 3, r \le 9\).