3. Consider the following problem and answer questions a) to c). A subsequence is a palindrome if it is the same when re

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

3. Consider the following problem and answer questions a) to c). A subsequence is a palindrome if it is the same when re

Post by answerhappygod »

3 Consider The Following Problem And Answer Questions A To C A Subsequence Is A Palindrome If It Is The Same When Re 1
3 Consider The Following Problem And Answer Questions A To C A Subsequence Is A Palindrome If It Is The Same When Re 1 (54.55 KiB) Viewed 24 times
3. Consider the following problem and answer questions a) to c). A subsequence is a palindrome if it is the same when read left to right and right to left. A subsequence does not have to be contiguous. Describe an efficient algorithm to find the longest subsequence which is a palindrome in a given string A = a₁a2... an. For example, the string abcab contains four palindromes of length 3 as subsequence: aba, aca, bcb, and bab, but no palindrome of length 4; thus, any palindrome of length 3 is an optimal solution. a) Create a recursive function L(i, j) that represents the length of the longest subsequence which is a palindrome in a, ... Aaj. b) How to create a memo to record the value of each L(i, j)? And to actually find the longest subsequence which is a palindrome in A, what extra info is needed? c) How to use the memo to find the solution to the problem? What is the running time of this dynamic programming algorithm?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply