This project is read-only.
1
Vote

Add: permutations with repetition

description

Implement as either a new class or a new iterator on the existing Permutation class. This capability would answer questions such as "What words can be spelled with the letters TEEF?"
Here is one possible implementation:
foreach (new Permutation (3).GetRowsWithRepetition (new int[] { 1, 2, 1 }))
which would produce:
{ 0, 1, 1, 2 }
{ 0, 1, 2, 1 }
{ 0, 2, 1, 1 }
{ 1, 0, 1, 2 }
{ 1, 1, 0, 2 }
{ 1, 1, 2, 0 }
{ 2, 0, 1, 1 }
{ 2, 1, 0, 1 }
{ 2, 1, 1, 0 }

comments