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 by string_ext for strings, and by list 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

Valid XHTML 1.0!