Recursive permutation method using lists
I am having difficulties writing a recursive method that displays all permutations of a list. It has to be recursive and not iterative and it has to take in a list<int>. I can write the method using a string parameter or making it iterative, but I can't for the life of me (i've been sitting here for the past 8 hours) write it recursively so that it takes in a list and displays all possible permutations.
Here is what I have so far:
iLst routeData::bestRoute(iLst done, iSet left)
{
iSetPtr setIterator;
for(setIterator = left.begin(); setIterator != left.end(); setIterator++)
{
iLst tempList = done;
iSet tempSet = left;
tempList.push_back(*setIterator);
tempSet.erase(setIterator);
bestRoute(tempList, tempSet);
}
return done;
}
It starts with the parameters {1} and {2, 3, 4} for example.

