[LCP]String comparison.

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Thu Feb 21 05:16:36 UTC 2002


> strcmp(), but that's no fun.  Another technique I can across 
> was generating a modulus for the string being searched for and 
> looking for lines in the second file with the same modulus value
> and only comparing those lines for an exact match.

I'm not sure looking at the code, but I think you're trying to
assign a "handle" to a string, then compare the handles, right ?
Good algorithms to create these is MD5, various CRC algorithms
(eg the adler32 sum from libz), etc. Any hash should do.
Basically, the trick is to get an algorithm which is as sensitive
as possible to the input data, so that two almost identical lines
generate different hashes. You thus get very unlikely false
positives (but they are still a possibility).

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20020221/bb85a003/attachment.htm 


More information about the linuxCprogramming mailing list