powered by
Given a permutation and two position, swap both positions
swap(perm, i, j)
The permutation in the input in which the two speicfied items have been swapped
a permutation
position of the permutation
swap(c(1,2,3,4,5),2,5)
Run the code above in your browser using DataLab