Nice! Passes my basket case:
C:\test>1118262 3 swaps => 1 2 3 a b c 4 swaps => 1 2 a b c d 5 swaps => 1 a b c d e 16 swaps => 1 2 3 4 5 6 7 8 a b c d e f g h i j 6 swaps => 1 2 3 a b c d e f
I took out the shorter/longer tests as that's never going to be a requirement. (Cool that it doesn't matter to the algorithm though!)
It'll take me a while to wrap my brain around it -- recursion always does -- but so far it ticks all the boxes. Thank you.
In reply to Re^2: [OT] Swapping buffers in place.
by BrowserUk
in thread [OT] Swapping buffers in place.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |