I am trying to understand the time and space complexity of this method. I read the following post which attempts to explain recursive time/space complexity. Inspite of that I am still not sure how I would start determining the space and time complexity of this problem.
std::vector<std::vector<int>> fresult;
void findSum(int index,int target, std::vector<int> originals,std::vector<int> possiblities)
{
if (index == originals.size())
{
//Check if the target has been met
if (target == 0)
{
fresult.push_back(possiblities);
}
return;
}
if (originals[index] <= target)
{
possiblities.push_back(a);
findSum(index, target - originals[index], originals, possiblities);
possiblities.pop_back();
}
findSum(++index, target, originals, possiblities);
}
Any suggestions on how I can determine time/space complexity of this problem