2,673 views
2 2 votes
int f (int n){

       if (n==0)

         return 0;

       if(n==1)

         return 1;

else

return f(n-1)+f(n-2);

}

Find the upper bound and lower bound to the number of function calls for input size 'n'?

2 Answers

1 1 vote

O(2^n) function coll

 

Position:
Show:

Related questions

5 5 votes
3 3 answers
1.1k
1.1k views
GO Classes asked Aug 6, 2022
1,100 views
Consider the following pair of mutually recursive functions.int f(int n){ if (n==0) return 1; return f(n-1)+g(n-1); } int g(int n){ if (n==0) return 1; return g(n-1) - f(...
0 0 votes
1 1 answer
641
641 views
admin asked Jul 21, 2022
641 views
Consider the following $\text{C}$ function :int f(int n) { static int i = 1; if (n = 5) return n; n=n + i;i++; return f(n); }The value returned by $\text{f}(1)$ is :$5$$...
4 4 votes
1 1 answer
1.3k
1.3k views
GO Classes asked Apr 30, 2022
1,270 views
#include<stdio.h int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); p...
0 0 votes
2 2 answers
1.1k
1.1k views
go_editor asked Mar 27, 2020
1,060 views
When a function is recursively called, all automatic variables :are initialized during each execution of the functionare retained from the last executionare maintained in...