Optimized prefixTrie to be more space efficient. The code has also been
refactored to be a little more clear. Added a second version of string
permutation.