Search code examples
javascriptstringalgorithmstring-comparison

Where can i find the histogram diff algorithm on internet?


Where can i find the histogram diff algorithm on internet. I want to compare two texts and find the differences, currently i am trying the patience diff algorithm,but that does not work that effective, i have heard like histogram diff algorithm is an improved version of patience diff


Solution

  • The git software implements both patience and histogram diff algorithms. See also: What's the difference between `git diff --patience` and `git diff --histogram`?

    If you have git installed, the commands are:

    git diff --histogram
    git diff --patience
    

    Your question has the javascript tag. I assume you are looking for a library, or a description of the algorithm so you can implement it yourself. The library used by git is libxdiff. Another diff library is xdelta.

    Links: