I've heard in my degree classes that a HashTable
will place a new entry into the 'next available' bucket if the new Key entry collides with another.
How would the HashTable
still return the correct Value if this collision occurs when calling for one back with the collision key?
I'm assuming that the Keys
are String
type and the hashCode()
returns the default generated by say Java.
If I implement my own hashing function and use it as part of a look-up table (i.e. a HashMap
or Dictionary
), what strategies exist for dealing with collisions?
I've even seen notes relating to prime numbers! Information not so clear from Google search.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…