Founder & CTO @SMERGERS & @wealthrox
Past - Dev Infra @Google · RF @NI · CS @USC

Currently
Founder & CTO @SMERGERS & @wealthrox
Previously
Dev Infra Intern @Google NYC RF @NI-WCDMA
Computer Science @USC
Contact
hey [at] krishnabharadwaj.info
27-Aug-2008

Apart from Johnson trotter, Permutations can be generated in many ways. The two methods i'll be discussing here are :

1. Recursive Method
2. Minimal Change Method or Bottom up approach.

1. Recursive Method

In this method, we take out a character at position 'I' and permute the rest of the string recursively. It goes something like this.. Lets say
"abc" is the string.

a + permute("bc") = abc & acb
b + permute("ac") = bac & bca
c + permute("ab") = cab & cba

There by generating all the permutations.

2. Minimal Change Method or Bottom up approach.
In this method, we start from a single character, append a new character and rotate the newly appended character covering all positions in the string. Like this..

a
ab, ba
abc,acb,cab,bac,bca,cba