| 1 | Start permute at index 0 | - | [1, 2, 3] | Begin permutation |
| 2 | Swap indices 0 and 0 | (0,0) | [1, 2, 3] | Swap element with itself |
| 3 | Recurse permute at index 1 | - | [1, 2, 3] | Permute subarray from index 1 |
| 4 | Swap indices 1 and 1 | (1,1) | [1, 2, 3] | Swap element with itself |
| 5 | Recurse permute at index 2 | - | [1, 2, 3] | Permute subarray from index 2 |
| 6 | Swap indices 2 and 2 | (2,2) | [1, 2, 3] | Swap element with itself |
| 7 | Recurse permute at index 3 | - | [1, 2, 3] | Reached end, print permutation |
| 8 | Backtrack swap indices 2 and 2 | (2,2) | [1, 2, 3] | Restore array |
| 9 | Backtrack swap indices 1 and 1 | (1,1) | [1, 2, 3] | Restore array |
| 10 | Swap indices 1 and 2 | (1,2) | [1, 3, 2] | Swap to try new element at index 1 |
| 11 | Recurse permute at index 2 | - | [1, 3, 2] | Permute subarray from index 2 |
| 12 | Swap indices 2 and 2 | (2,2) | [1, 3, 2] | Swap element with itself |
| 13 | Recurse permute at index 3 | - | [1, 3, 2] | Reached end, print permutation |
| 14 | Backtrack swap indices 2 and 2 | (2,2) | [1, 3, 2] | Restore array |
| 15 | Backtrack swap indices 1 and 2 | (1,2) | [1, 2, 3] | Restore array |
| 16 | Backtrack swap indices 0 and 0 | (0,0) | [1, 2, 3] | Restore array |
| 17 | Swap indices 0 and 1 | (0,1) | [2, 1, 3] | Swap to try new element at index 0 |
| 18 | Recurse permute at index 1 | - | [2, 1, 3] | Permute subarray from index 1 |
| 19 | Swap indices 1 and 1 | (1,1) | [2, 1, 3] | Swap element with itself |
| 20 | Recurse permute at index 2 | - | [2, 1, 3] | Permute subarray from index 2 |
| 21 | Swap indices 2 and 2 | (2,2) | [2, 1, 3] | Swap element with itself |
| 22 | Recurse permute at index 3 | - | [2, 1, 3] | Reached end, print permutation |
| 23 | Backtrack swap indices 2 and 2 | (2,2) | [2, 1, 3] | Restore array |
| 24 | Backtrack swap indices 1 and 1 | (1,1) | [2, 1, 3] | Restore array |
| 25 | Swap indices 1 and 2 | (1,2) | [2, 3, 1] | Swap to try new element at index 1 |
| 26 | Recurse permute at index 2 | - | [2, 3, 1] | Permute subarray from index 2 |
| 27 | Swap indices 2 and 2 | (2,2) | [2, 3, 1] | Swap element with itself |
| 28 | Recurse permute at index 3 | - | [2, 3, 1] | Reached end, print permutation |
| 29 | Backtrack swap indices 2 and 2 | (2,2) | [2, 3, 1] | Restore array |
| 30 | Backtrack swap indices 1 and 2 | (1,2) | [2, 1, 3] | Restore array |
| 31 | Backtrack swap indices 0 and 1 | (0,1) | [1, 2, 3] | Restore array |
| 32 | Swap indices 0 and 2 | (0,2) | [3, 2, 1] | Swap to try new element at index 0 |
| 33 | Recurse permute at index 1 | - | [3, 2, 1] | Permute subarray from index 1 |
| 34 | Swap indices 1 and 1 | (1,1) | [3, 2, 1] | Swap element with itself |
| 35 | Recurse permute at index 2 | - | [3, 2, 1] | Permute subarray from index 2 |
| 36 | Swap indices 2 and 2 | (2,2) | [3, 2, 1] | Swap element with itself |
| 37 | Recurse permute at index 3 | - | [3, 2, 1] | Reached end, print permutation |
| 38 | Backtrack swap indices 2 and 2 | (2,2) | [3, 2, 1] | Restore array |
| 39 | Backtrack swap indices 1 and 1 | (1,1) | [3, 2, 1] | Restore array |
| 40 | Swap indices 1 and 2 | (1,2) | [3, 1, 2] | Swap to try new element at index 1 |
| 41 | Recurse permute at index 2 | - | [3, 1, 2] | Permute subarray from index 2 |
| 42 | Swap indices 2 and 2 | (2,2) | [3, 1, 2] | Swap element with itself |
| 43 | Recurse permute at index 3 | - | [3, 1, 2] | Reached end, print permutation |
| 44 | Backtrack swap indices 2 and 2 | (2,2) | [3, 1, 2] | Restore array |
| 45 | Backtrack swap indices 1 and 2 | (1,2) | [3, 2, 1] | Restore array |
| 46 | Backtrack swap indices 0 and 2 | (0,2) | [1, 2, 3] | Restore array |
| 47 | End | - | [1, 2, 3] | All permutations generated |