Permn: Determine All Possible Permutations of a Set
Description
Return the set of permutations for a given set of values.
The values can be numeric values, characters or factors.
Usage
Permn(x)
Arguments
x
a vector of numeric values or characters. Characters need not be unique.
Value
a data.frame with all possible permutations of the values in x.
Details
This is an implementation of the Steinhaus-Johnson-Trotter permutation algorithm.
References
Steinhaus, H. (1964): One hundred problems in elementary mathematics, New York: Basic Books, pp. 49-50
Johnson, Selmer M. (1963): Generation of permutations by adjacent transposition, Mathematics of Computation 17
Trotter, H. F. (August 1962): Algorithm 115: Perm, Communications of the ACM 5 (8)
Sedgewick, R. (1977): Permutation generation methods, ACM Comput. Surv. 9 (2)