Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In general, the hardest task of dynamic programming is to find and define the right recursion for the problem a recursion that makes exponentially-many recursive
In general, the hardest task of dynamic programming is to find and define the right recursion for the problem a recursion that makes exponentially-many recursive calls in a direct implementation, and yet all of the calls are in some poly-size domain. For each problem below, find such a recursion. Then explain how you solve the problem in a bottom-up fashion by using a suitably defined array and a formula to fill the array based on previously-filled cells. For this problem you do not need to write a pseudocode as part of your explanation.
Question 2 (10 marks) In general, the hardest task of dynamic programming is to find and define the right" recursion for the problem a recursion that makes exponentially-many recursive calls in a direct implementation, and yet all of the calls are in some poly-size domain. For each problem below, find such a recursion. Then explain how you solve the problem in a bottom-up fashion by using a suitably defined array and a formula to fill the array based on previously-filled cells. For this problem you do not need to write a pseudocode as part of your explanation. a. (5 marks) The LONGEST SUB-PALINDROME problem: given a sequence X (zi, ...,an) find the longest subsequence 21 ...,zik) such that ij i for any j, and that is a palindrome: k is even and (z j+1 the inverse sequence (z rk-1 i is identical to the original sequence 21 in). (E.g abba is a Ti sub-palidrome of "tablebrand.") b. (5 marks) The LONGEST SIMPLE PATH problem: Suppose that we are given a directed acyclic graph G (V, E) with real-valued weights and two distinguished vertices s and t. The goal is to find a longest weighted simple path from s to tStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started