Merge two strings (text files) [duplicate]
Possible Duplicate:
Any decent text diff/merge engine for .NET ?
I got two text files that I would like to merge in some way. The first is just a edited version of the second.
Are there any open source tools available which can help me with that?
Edit: I want to find the changes between the two files and merge them as subversion does when it updates code files.
See example in this arkicle: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem.
Firstly you have two big files. Then you should find their longest common subsequence (LCS) and divide files to three parts:
1: Before LCS;
2: LCS;
3: After LCS.
Then you should compare independent parts "1" and parts "2" (you have a recursion). Iteratively you decrease secuence to compare.
Total complexity will be between O(n*log(n)) and O(n*n).
精彩评论