You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The LCS algorithm for array diffing works well, but could be made more efficient by combining the lcs construction and the subsequent reduce, and by returning early in cases where it's not necessary to create the lcs matrix:
Two passes are done on the common prefix. Could be reduced to 1 pass if lcs() and reduce() are combined.
The LCS matrix construction can be skipped entirely when the common prefix + suffix length === a.length or b.length (or both). When:
prefix+suffix length === a.length === b.length, can return immediately. No work to do.
prefix+suffix length === a.length, can emit remaining span of b as additions
prefix+suffix length === b.length, can emit remaining span of a as removals
The text was updated successfully, but these errors were encountered:
The LCS algorithm for array diffing works well, but could be made more efficient by combining the lcs construction and the subsequent reduce, and by returning early in cases where it's not necessary to create the lcs matrix:
The text was updated successfully, but these errors were encountered: