So for example if I had the string "ab" then the sequence ["ab", "ba"] would be returned.
here is a Wikipedia link on permutations.
Here is a bigger example, If I have the string "ish" then I would have the following permutations
ish ihs shi sih his hsi
I found this tool for generating the permutations, that way you can check it.
And for extra kudos don't use the C++ standard library for finding the permutations
For those of who are less familiar with the C++ stranded library have a look at the algorithm library.
Here is a good function prototype to use, you can make it what ever you want though.
void P(std::vector<std::string>& perms, std::string str);
Also one last thing, please use spoiler tags when posting solutions. that way everyone can have a fair chance at coming up with there own solution.
[ spoiler]
And most importantly, have fun!!
once the challenge gets going some more, ill post my two solutions. one using the standard library and the other without.

New Topic/Question
Reply






MultiQuote







|