When order matters, such as every way to arrange letters or seat people, you need permutations instead of subsets. Backtracking with a used array tries each unused element at each position. There are n! orderings, so this only works for n up to about 8 to 10. If you just need the next arrangement in sorted order or a count, use a formula or the next-permutation trick rather than generating all of them.