Explanation of answer of Q3

As question calls the recursive function N times, therefore I thought the answer is N, can anyone tell how the answer is O(N2)?

@ayusdas2000
In each call you only perform addition operation which is 0(1)
And the recursive function adds value of all elements in vector which is of size N
So complexity is 0(n)

Kindly close the doubt


Then why answer in O(N2)

@ayusdas2000
I forgot to take into account one thing
We are passing vector by value not by reference
So in each function call the entire vector is copied which takes 0(n) time
And function is called N times
So O(n^2)