lcs

Longest Common Subsequence (LCS) using Hirschberg. Linear-Space Faster Dynamic Programming Version.

Time Complexity: O(m*n) Space Complexity: O(min(m,n))

To speed up this code on DMD remove the memory allocations from lcsLengths, and do not use the retro range (replace it with foreach_reverse)

pure
const(T)[]
lcs
(
T
)
(
in T[] xs
,
in T[] ys
)

See Also

Meta