Answered step by step
Verified Expert Solution
Link Copied!

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.

a. (5 marks) The Longest Sub-Palindrome problem: given a sequence X = find the longest subsequence such that ij < ij+1 for any j, and that is a palindrome: k is even and the inverse sequence is identical to the original sequence . (E.g., abba is a 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 t.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago