The comedian, Demetri Martin, is the author of a 224-word palindrome poem. That is, like any palindrome,

Question:

The comedian, Demetri Martin, is the author of a 224-word palindrome poem. That is, like any palindrome, the letters of this poem are the same whether they are read forward or backward. At some level, this is no great achievement, because there is a palindrome inside every poem, which we explore in this exercise. Describe an efficient algorithm for taking any character string, S, of length n, and finding the longest subsequence of S that is a palindrome. For instance, the string, “I EAT GUITAR MAGAZINES” has “EATITAE” and “IAGAGAI” as palindrome subsequences. Your algorithm should run in time O(n2).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Algorithm Design And Applications

ISBN: 9781118335918

1st Edition

Authors: Michael T. Goodrich, Roberto Tamassia

Question Posted: