Any algorithm for generating permutations is going to run in polynomial time, because the number of permutations for characters within an n-length string is (n!)
. That said, there are some pretty simple in-place algorithms for generating permutations. Check out the Johnson-Trotter algorithm.