Consider the function given below.

int cal(int n)

{

            if(n<=1) return 1;

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

}

Choose the appropriate choices from the given options.

1
The number of function calls for n can be given by solving recurrence relation T(n) =  T(n-1) + T(n-2).
2

The number of function calls for n can be given by solving the recurrence relation

T(n) = T(n-1) + T(n-2) + 1, where T(1) = T(0)= 1.
3
The number of the function calls for n = 5 are 15
4
The value return by the function for n = 8 is 34.

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation