F
Francesc Benavent
I have some problem with a hashtable keyed by strings due to some
object collisions.
I've read from sources like:
http://groups.google.com/groups?hl=...befb&seekm=eOuZ99ctBHA.1272@tkmsftngp03#link1
that collisions in string hashes are negligible, but testing with an
english dictionary with 350.000 words the hastbale produced 64
collisions. It can seem a few but I think that 1 collision in 5000
words are too!!
The smallest code to show my problem is next:
Console.WriteLine( "{0} = {1}",
"blair".GetHashCode(),
"brainlessness".GetHashCode()
);
The Console outputs:
175803953 = 175803953
How is possible that in a space so huge like a Int32 (4 billions)
there were collision in 1 of 5000 cases? I've trying other no standar
hashing functions but all them worked worst than GetHashCode()...
I hope that I were missing some important concept. Somebody has tried
to hashing a big dictionary in a hashtable? Somebody has any clue
about what I'm doing bad?
thanks very much,
Francesc
object collisions.
I've read from sources like:
http://groups.google.com/groups?hl=...befb&seekm=eOuZ99ctBHA.1272@tkmsftngp03#link1
that collisions in string hashes are negligible, but testing with an
english dictionary with 350.000 words the hastbale produced 64
collisions. It can seem a few but I think that 1 collision in 5000
words are too!!
The smallest code to show my problem is next:
Console.WriteLine( "{0} = {1}",
"blair".GetHashCode(),
"brainlessness".GetHashCode()
);
The Console outputs:
175803953 = 175803953
How is possible that in a space so huge like a Int32 (4 billions)
there were collision in 1 of 5000 cases? I've trying other no standar
hashing functions but all them worked worst than GetHashCode()...
I hope that I were missing some important concept. Somebody has tried
to hashing a big dictionary in a hashtable? Somebody has any clue
about what I'm doing bad?
thanks very much,
Francesc