Question: Given the following recursive function: f(i)=1 f(2)=2 f(n) = f (lD) + f (1:1) for all multiples of 2 greater than 2 Answer 1-4 1.

Given the following recursive function: f(i)=1 f(2)=2 f(n) = f (lD) + f (1:1) for all multiples of 2 greater than 2 Answer 1-4 1. Write a recursive algorithm compute f(n). 2. Give a non-recursive optimal algorithm (i.e. Dynamic programming algorithm) for computing the function f(n). What is the run time for your algorithm in terms of O-notation? 3. which is faster the recursive algorithm or the dynamic programming algorithm? Justify your answer 4. Does dynamic programming always yield to an optimal solution? 12 B
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
