Concept Flow - Generate All Permutations of Array
Start with full array
Choose element at index i
Swap element i with element j
Recurse with next index i+1
If i == array length, record permutation
Backtrack: swap back elements i and j
Back to choose next j
Repeat until all permutations generated
↩Back to choose next j
We pick each element in turn, swap it to the current position, recurse to fix the next position, and backtrack by swapping back to explore all permutations.
