Question: Problem 5. (20 points) A palindrome is a nonempty string that reads the same forward and backward. Examples of palindromes are: civic and race- car.
Problem 5. (20 points) A palindrome is a nonempty string that reads the same forward and backward. Examples of palindromes are: civic and race- car. Write a recursive dynamic programming formulation to find efficiently the longest palindrome that is a subsequence of a given input string. For example carac is the longest palindrome that is a subsequence of the string character. Based on this formulation write an algorithm to find this palindrome given an input string. Derive the time complexity of this algorithm. (Hint: Define F(ij) as the length of the longest palindrome that is a subsequence of the string Xi, ....; where 0 sisi
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
