Question: Given functions T 1 and T 2 : Function T 1 : public int T 1 ( int n ) { if ( n <

Given functions T1 and T2:
Function T1:
public int T1( int n ){
if (n <1){
return 0;
}// if
else {
return (2*n + T1( n-1));
}// else
}// T1
(a) Set up a recurrence relation for the running time of the function T1 as a function of n. Solve your recurrence relation to specify theta bound of T1.
Function T2:
public int T2(int n){
if (n <1){
return 0;
}// if
else {
return (T1(n)+ T2(n-1) n);
}// else
}// T2
(b) Now set up a recurrence relation for the running time of the function T2 as a function of n. Solve your recurrence relation to specify theta bound of T2.

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 Programming Questions!