Possible Duplicates:
Generating permutations lazily
How to generate all permutations of a list in Python
Algorithm to generate all possible permutations of a list?
I didn't think this could be tough, but I'm having problem to come up with an algorithm to find all variations of n
characters. We can assume each character only appear once in the pool of characters. Also each variation contains all the characters in the pool.
E.g.
pool: abc
variations:
- abc
- acb
- bac
- bca
- cab
- cba
Edit: Changed the word variations to permutations after David Zaslavsky answer.