LCSclass | misc.t[2132]

LCS - class that computes the Longest Common Subsequence for two lists or vectors.

The LCS is most frequently used as a differencing tool, to compute a description of how two data sets differ. This is at the core of tools like "diff", which shows the differences between two versions of a file. The LCS is the part of the two sets that's the same, so everything in one of the sets that's not in the LCS is unique to that set. The standard diff algorithm computes the LCS, then generates a list of edits by specifying a "delete" operation on each item in the "new" set that's not in the LCS, and an "insert" operation on each item in the "old" set that's not in the LCS. Merge and sort the two edit lists and you have basically the standard Unix "diff" output. (Some diff utilities make the report more readable by combining overlapping edit and insert operations into "update" operations. But it's really the same thing, of course.)

The constructor does all the work: use 'new' to create an instance of this class, providing the two lists to be compared as arguments. The resulting object contains the LCS information.

Note that you can use this class to generate a character-by-character LCS for two strings, simply by using toUnicode() to convert each string to a list of character values.

`class LCS : object`

Superclass Tree (in declaration order)

`LCS`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`lcsA lcsB`

Summary of Methods

`construct`

Properties

`lcsA` | `misc.t[2197]`

the LCS, as lists of character indices into the respective strings

`lcsB` | `misc.t[2198]`

no description available

Methods

`construct (a, b)` | `misc.t[2133]`

no description available

Adv3Lite Library Reference Manual
Generated on 01/03/2024 from adv3Lite version 1.6.2