This crate provides the Change
enum as an abstraction for lcs_diff::DiffResult
and
wu_diff::DiffResult
; the [lcs_changes()
], [lcs_diff
()], [wu_changes
()], and
[wu_diff
()] functions to calculate or process diffs between a
and b
slices via LCS
(Longest Common Subsequence) or Wu diff algorithms into a [Vec<Change>
], and the [patch()
]
function to reproduce b
from the a
slice and [Vec<Change>
].
See also:
- Hunt, James W; Szymanski, Thomas G. (1977). "A fast algorithm for computing longest common subsequences" http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/HuSz77.pdf
- Wu, Sun; Manber, Udi; Myers, Gene (1989). "An O(NP) Sequence Comparison Algorithm" https://publications.mpi-cbg.de/Wu_1990_6334.pdf
- Department of Mathematics and Computer Science. University of Southern Denmark (January 12, 2017). "The Hunt-Szymanski Algorithm for LCS" https://imada.sdu.dk/~rolf/Edu/DM823/E16/HuntSzymanski.pdf
- lcs-diff crate
- wu-diff crate
- Wikipedia: Hunt–Szymanski algorithm
- Wikipedia: Bitap algorithm
- Practical use case analysis