= Permutation generation
<Permutation generation> enumerates arrangements of a finite collection under a stated convention. For $n$ distinct labelled objects there are $n!$ <permutations>, so explicitly writing every length-$n$ arrangement already requires $\Omega(n\,n!)$ output work. <Permutation generation by insertion> builds each arrangement from a shorter one; the <Steinhaus-Johnson-Trotter algorithm> instead changes only an <adjacent transposition> between consecutive arrangements. Repeated values require deciding whether positions remain distinguishable. For values `a,a,b`, there are six <permutations> of labelled positions but only three distinct value strings.
Back to article page