http://en.wikipedia.org/wiki/Longest_common_subsequence_problem

 

To find the longest subsequences common to Xi and Yj, compare the elements xi and yi. If they are equal, then the sequence LCS(Xi-1, Yj-1) is extended by that element, xi. If they are not equal, then the longer of the two sequences, LCS(Xi, Yj-1), and LCS(Xi-1, Yj), is retained. (If they are both the same length, but not identical, then both are retained.) Notice that the subscripts are reduced by 1 in these formulas. That can result in a subscript of 0. Since the sequence elements are defined to start at 1, it was necessary to add the requirement that the LCS is empty when a subscript is zero.

 

http://www.csie.ntnu.edu.tw/~u91029/LongestCommonSubsequence.html 

相关文章:

  • 2021-06-26
  • 2022-01-06
  • 2021-09-28
  • 2021-11-11
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
猜你喜欢
  • 2021-06-08
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案