To generate all permutations, use backtracking:
Maintain a current permutation being built
Track which elements are already used
Try adding each unused element, recurse, then backtrack
When the permutation is complete (length equals n), add it to results
This explores all n! permutations.