Permutations by swapping: Difference between revisions

m
mNo edit summary
Line 1,651:
johnsontrotter(1,4)
</lang>
Recursive (note this uses memory of roughtly (n+1)! bytes, where n is the number of elements, in order to store the accumulated permutations in a list, and so the iterative solution is to be preferred for larger numbers of elements):
Recursive:
<lang julia>
function johnsontrotter(low, high)
4,102

edits