This is a tool for finding the differences between two text files and in particular finding what parts have been edited, deleted or added. It implements one of the algorithms for finding the Longest Common Subsequence between to data sources.

You can see a demo at:

The main idea of this algorithm is to build a matrix with rows – future state, and columns – previous state. This matrix will consist of squares incorporated one into the other as steps in a stairway. The path of following those steps from the top left corner to the right bottom corner determines the actual graph. Moves to the right are deletes, to the bottom – inserts. Inserts followed by deletes are changes.

All the code is inline, so it is easy to reuse and understand. It involves no server side code, or anything other than the included JavaScript. Because of the lack of hashing optimizations or any other algorithm optimizations, the source is limited to 500 lines maximum for performance reasons.

It is also available on codeplex at

A better implementation with Silverlight 4:
Blog Entry:

Share this post:   digg     Stumble Upon     E-mail

Commenting temporarily disabled