Question: Consider the following C - function: double foo ( int n ) { int i; double sum; if ( n = = 0 ) return

Consider the following C-function:
double foo (int n)
{
int i;
double sum;
if (n ==0) return 1.0;
else
{
sum =0.0;
for (i =0; i < n; i++)
sum += foo (i);
return sum;
}
}
The space complexity of the above function is:
Question 4 options:
O(nn)
O(n!)
O(1)
O(n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!