Skip Navigation --> An O(ND) Difference Algorithm for C#

An O(ND) Difference Algorithm for C#

An C# implementation of the difference algorithm published in "An O(ND) Difference Algorithm and its Variations" by Eugene Myers Algorithmica Vol. 1 No. 2, 1986, p 251.

This article is about comparing text files and the proven, best and most famous algorythm to identify the differences between them. The source code that you can find in the download implements a small class with a simple to use API that just does this job. You should have it in the bag of your algorythms.

Documentation and source code:

The documentation:
This is a detailed documentation for the Diff class that explains some of the backgrounds, concepts and the API.

Diff characters:
This is a step by step sample how to use the Diff class for comparing 2 strings on a character basis.

Source code:
The Source code (25 kByte for the class) is availabe as a zip archive. You can also view the source code directly through: ViewSrc

Sample diff results using the older and actual versions of the Diff source code:

These links use the difference algorithm for comparing files and formatting the result as HTML. You can follow the evolution of it since 2002. There was no need for a bug fixing since February 2003:

This page is part of the web site.