collections/lcs_sequence_utils library

Longest common subsequence (LCS) of two lists. Roadmap #69.

A subsequence keeps relative order but allows gaps (unlike a substring, which must be contiguous — see lcs_substring_utils.dart). LCS is the basis of diff tooling: the elements NOT in the LCS are exactly the insertions and deletions between the two sequences.

Functions

longestCommonSubsequence<T>(List<T> a, List<T> b) List<T>
Returns one longest common subsequence of a and b, compared with ==.
longestCommonSubsequenceLength<T>(List<T> a, List<T> b) int
Returns the length of the longest common subsequence of a and b.