Question: (4 pts) Consider the following function f2. Write a recurrence equation for the running time T(n) of this method as a function of n. Assume

 (4 pts) Consider the following function f2. Write a recurrence equation

(4 pts) Consider the following function f2. Write a recurrence equation for the running time T(n) of this method as a function of n. Assume that doubling a number takes constant time. Assume that you have already checked that the argument n is positive. (I am not asking you to solve the recurrence relation, just write it.) No explanation required, just "T(n) = ". Asume that all arithmetic (+,-*./) takes constant time. int f2 ( int n) { if ( (n = 0 ) TI (n == 1)) { return n; } else { return ( f(n-1) + f(n/2)); } }

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!