Permutations: Difference between revisions

Line 1,517:
3 2 1</pre>
 
=== Alternate solution ===
 
Instead of looking up unused values, this program starts from [1, ..., n] and does only swaps, hence the array always represents a valid permutation.
Anonymous user