Module lcs
Longest Common Subsequence algorithm. After pseudo-code in lecture notes by David Eppstein.
Functions
longestCommonSubseq (a, b, s) | Find the longest common subsequence of two sequences. |
Functions
- longestCommonSubseq (a, b, s)
-
Find the longest common subsequence of two sequences. The sequence objects must have an
__append
metamethod. This is provided bystring_ext
for strings, and bylist
for lists.Parameters
- a: first sequence
- b: second sequence
- s: an empty sequence of the same type, to hold the result
Return value:
the LCS of a and b