in reply to sort with fewest moves
Here's an algorithm to find a solution using the shortest possible number of moves. It assumes that you know the proper order for the tapes, which you should, because figuring that out requires zero moves.
- Starting at slot 1, find the first tape that is not in the right slot.
- Move that tape to slot 0.
- Since that tape was not in the right slot, there is another tape which belongs in that slot. Find that tape and move it into the right slot.
- Repeat the previous step until the tape in slot 0 is moved into the right slot.