I'm given a string that I need to find all permutations of, the thing is I'm restricted to calling it recursively and it returning void, taking only one string parameter:

Code:

void permute(string& word);

The thing Is I just can't work out why it can be recursive. I would understand if it took another parameter, possibly int fact, which would be the n! which is how many times it would need to call itself, reaching a base case that:

Code:

if(fact == 0)
return
else
{
permute(word, n-1)
//do the permutation routine
}

I've figured out a routine to do the permutation, which is just moving around a substring of the words exluding the first, then just going down the word, but I'm restricted to using one parameter. Maybe I'm just not good at the recursion.