allperms | R Documentation |
Function allperms()
returns all \mjseqnn factorial permutations
of a set. Function allcyc()
returns all \mjseqn(n-1)!
permutations comprising a single cycle of length \mjseqnn.
allperms(n) allcyc(n)
n |
The size of the set, integer |
Function allperms()
is very basic (the idiom is
word(t(partitions::perms(n)))
) but is here for completeness.
Function allcyc()
is taken directly from Er's
“fine-tuned” algorithm. It should really be implemented in
C as part of the partitions package but I have not
yet got round to this.
Robin K. S. Hankin
M. C. Er 1989 “Efficient enumeration of cyclic permutations in situ”. International Journal of Computer Mathematics, volume 29:2-4, pp121-129.
allperms
allperms(5) allcyc(5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.