Question: Given the functions below: int fun 1 ( int n ) { if ( n < = 1 ) return n; return 2 * fun

Given the functions below:
int fun1(int n){
if (n <=1)
return n;
return
2*fun1(n-1);
}
int fun2(int n){
if (n <=1)
return n;
return
fun2(n-1)+ fun2(n-1);
}
The complexity of the functions, fun1 and fun2, are respectively described by
A) O(2^n), O(2^n)
B) O(n), O(2^n)
C) O(2^n), O(n)
D) O(n), O(n)
E) None of the above

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!