Combinations and Permutations: UPDATE

This version brings updates to how it finds out all permutations, in the older version it used to search through the so far generated nodes backwards and pick a number that wasn’t used(dumb by all means, but got the job done). But when looked at it from a different perspective, why not have something like a dictionary? When used, mark it. But again there would be a problem of copying the whole array for the next call of the recursive method: it feels like we’d have to copy the whole thing but it doesn’t need to. What I did was to remove the change done after the recursive call, it was not a planned move but it should work. There was no reason not to. Done.

Download the source