Question: Problem 3 . ( 3 5 % ) Consider the following dummy recursive function: 1 For ESTR students, please feel free to use the generating
Problem Consider the following dummy recursive function: For ESTR students, please feel free to use the generating function method if you feel more comfortable with the latter. Homework funcn for i n: y ii end for if n : return elseif n : return else: return funcn funcn end if We define Tn as the number of multiplication steps involved, ie the computation complexity, when running funcn with the input n where n in N Note that calculating ii involves one multiplications. For example, we observe that T and T since respectively and multiplications are involved with the forloop, before the function terminates. a can be challenging Write down an inhomogeneous linear recursion for Tn Solve the recursion. Remark: Notice that T T as mentioned above. Try substituting different numbers of n as the input to the function and count the number of multiplications needed. b Another function funcn has the complexity, Hn governed by the recursion: for some a Hn aHn n H Solve the above recursion for Hnc Using the results from ab
Which of the two functions is more efficient asymptotically, funcn or funcn Justify your answer. In other words, determine if Tn oH
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
