Generate all permutations of a given sequence by swapping and backtracking.
Explain code with DocComment! Try out your own code!