powered by
An implementation of the Steinhaus-Johnson-Trotter permutation algorithm.
permutations(set)
a matrix whose rows are the permutations of set
a set
permutations(1:3) permutations(c('first','second','third')) permutations(c(1,1,3)) apply(permutations(letters[1:6]), 1, paste, collapse = '')
Run the code above in your browser using DataLab