Given an integer n, return a matrix whose columns enumerate various
permutations of 1:n.
Function perms() returns all permutations in lexicographic
order; function plainperms() returns all permutations by
repeatedly exchanging adjacent pairs.
Usage
perms(n)
plainperms(n)
Arguments
n
Integer argument; permutations of 1:n returned
Note
Comments in the C code; algorithm lifted from
‘fasc2b.pdf’.
Author(s)
D. E. Knuth; C and R transliteration by Robin K. S. Hankin