GeeksforGeeks » Algorithms
Space Complexity?
(3 posts)-
double foo(int n) { int i; double sum; if(n==0) retrun 1; else { sum = 0; for (i=0; i<n; i++) sum+=foo(i); retrun sum; } }wht is the space complwexity of thsi???
-
O(n^2) for recursive function calls.
-
I think space is system stack in recursion so we are not to care about the space in this...
Reply
You must log in to post.