Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A palindrome is a nonempty string over some alphabet that reads the same forward

ID: 3774338 • Letter: A

Question

A palindrome is a nonempty string over some alphabet that reads the same forward and backward. Examples of palindromes are all strings of length 1, civic, racecar, abba,… Give a DP algorithm to find the length of the longest palindrome that is a subsequence of a given input string. Write a program to solve this problem.  Examples: Given the input “character”, your algorithm should return 5 for  “carac”. Given the input “TTATGTGAT”, your algorithm should return 7 for “TATGTAT”. Note that TTATT is a palindromic subsequence but is not the longest. IN C#

Explanation / Answer

c[i, i+j] = max( c[i+1, i+j] , c[i, i+j-1] )compute-lps(s, n):

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote