Given this method: METHOD math1: public int mathl( int n) { if (n< 1){ return 0; } // if else { return ( 2*n + mathl( n-1)); } // else } // mathi (a) Set up a recurrence relation for the running time of the method math as a function of n. Solve your recurrence relation to specify theta bound of math. METHOD math2: public int math2(int n) { if (n ) { return 0; else { return mathl(n) + math2(n-1) - n; } // else } // math2 (b) Now set up a recurrence relation for the running time of the method math2 as a function of n Solve your recurrence relation to specify theta bound of math1. HINT: When doing this, the call to math1 can be replaced by the equation that you found when solving the recurrence relation for math1 in part a).



Answer :