Page 1 of 1

Longest Palindrome Subsequence (LPS) is a "poster child" for recursion and very hard to solve in any other way. In this

Posted: Mon Jul 11, 2022 9:54 am
by answerhappygod
Longest Palindrome Subsequence Lps Is A Poster Child For Recursion And Very Hard To Solve In Any Other Way In This 1
Longest Palindrome Subsequence Lps Is A Poster Child For Recursion And Very Hard To Solve In Any Other Way In This 1 (149.01 KiB) Viewed 32 times
Longest Palindrome Subsequence (LPS) is a "poster child" for recursion and very hard to solve in any other way. In this lab you will create class named LPS and within that class you will write two methods: 1ps Length (String str) and lpsString (...) Given a string str, 1ps Length (String str) returns the length of the LPS in str lps String (...) returns one LPS string You may assume that the initial given string str is not an empty string. Here are some examples. str zryxadavr aaxyz abcxcybza Recursion Lab ATGCATCATTGACCA Lps length 5 2 7 10 Lps string radar aa abcxcba ACCATTACCA Notice that the sequence "zryxadavr" contains the palindrome subsequence "radar" within it: zryxadavr r ada r In fact, "radar", which has length 5, is the longest palindrome that can be found embedded in "zryxadavr". We say that "radar" is the longest palindromic subsequence (LPS) in the given string "zryxadavr".
Example1 Input string: zryxadavr Output: Ips length = 5 Ips string = radar Example 2 Input string: ATGCATCATTGACCA Output: Ips length = 10 Ips string = ACCATTACCA