作者mqazz1 (无法显示)
站内Prob_Solve
标题[问题] longest palindrome subsequence
时间Fri Nov 4 21:09:22 2011
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, and aibohphobia (fear of palindromes)
input: A[1...n]
m[i+1,j-1] + 1 , if A[i] = A[j]
m[i,j] = max{ m[i,j-1], m[i+1,j] } , if A[i] != A[j]
请问这个递回式是甚麽意思?
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.26.99
1F:→ firejox:就是i到j的最长回文子序列 如果第i个不等於第j个 11/04 22:22
2F:→ firejox:i到j的最长序列相当於 i到j-1 与 i+1到j的最长序列 11/04 22:23
3F:→ firejox:反之如果第i个等於第j个 就是i+1到j-1的最长序列+1 11/04 22:25