Page 1 of 1

Divide-and-Conquer • Q2(14 points): Suppose that a computer does not know how to apply dynamic programming techniques to

Posted: Tue Jul 12, 2022 8:16 am
by answerhappygod
Divide And Conquer Q2 14 Points Suppose That A Computer Does Not Know How To Apply Dynamic Programming Techniques To 1
Divide And Conquer Q2 14 Points Suppose That A Computer Does Not Know How To Apply Dynamic Programming Techniques To 1 (104 KiB) Viewed 23 times
Divide-and-Conquer • Q2(14 points): Suppose that a computer does not know how to apply dynamic programming techniques to compute a function f(n), but it knows how to use the divide and Conquer approach to compute f(n) as follows. The computer takes only constant time for scalar arithmetic operations. f(n) = { Divide: Do nothing. Conquer: Combine: if n = 0 if n = 1 f(n-1) + f(n − 2) +n if n>1 (a) (10 points) Please write down the three steps of Divide, Conquer and Combine to de- scribe how the computer calculates f(n). 1 (b)(4 points) Please write down the running time recurrence if f(n) is computed using the above approach.