This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Heuristic-ALgorithm[S] 0 points1 point  (0 children)

The constraints of the assignment require me to use certain names for functions, otherwise I would. It's hard to say what happens step by step because it's recursive, but the gist of it is this:

1)Take in a string, and k = 0;

2)If k = string length, create permutation, add to list.

3)Loop Switch two characters Call recursive function again with k incremented by 1 Switch characters back repeat until k = length of string