Time complexity of recursive function

Predict the time complexity of the following recursive function, given the vector is of size N and the initial call is calSum(v, 0).
int sum = 0;

void calcSum(vector v, int i)

{
if(i == v.size())

    return;
sum += v[i];
calcSum(v, i+1);

}

how is the above function having a complexity of O(2^N)

Hey @aditya.bachhawat0705
The answer is 0(n) which you may have answered correctly.
There is an issue with quizzes right now that we are trying to fix. Sorry for the inconvenience caused.

Unless there is anything else I can help you with kindly mark this query as resolved.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like