[thelist] Diff algorithm in JavaScript
Fernando Gomez
fgomez at criba.edu.ar
Fri Nov 28 14:57:15 CST 2003
Simon Perry wrote:
> Javascript supports hashes[1] so the approach I would take would be to
> create two hash objects to store your form data. Then iterate through
> the original hash to create a new array of data sets that have been
> added then again for those that have been removed.
Thank you Simon for the answer.
After sending my message to thelist, I did some more Google-based
research, and found a reference to the paper:
P. Heckel, `A technique for isolating differences between files', Comm.
ACM, 21, (4), 264--268 (1978).
Heckel presents there a simple algorithm, which does pretty much what I
was needing.
I found on the Web an implementation of the algorithm in C, another one
in VB, but nothing in JavaScript, so I wrote the JS code myself, and it
is working! :)
It still needs some adjustement in the final part, the part when it has
to show the differences found.
I post this comment just in case anyone is interested in the code: write
an email and I'll send it.
Best wishes,
--Fernando
More information about the thelist
mailing list