double hashing with collision on first and second hash functions-java -


for double hashing, if there collision first hash function, you'd use second hash function, if there still collision? example, let's hash table size 15 , hash function (key + 3) % 15 , second hash function ((key % 8) / 3) + 2. let's "insert 59" goes index 2 first hash function there key there. second hash function bring 3 let's there value there too. 59 inserted on hash table , why? thanks

i want use double hashing, not chained hashing or linear probing.

it not way calculate second hash function, since every probe(unavailability of slot) need have new hash function , not feasible.

generic second hash function of type,

h1(x) - first hash function, h2(x) - second hash function

first time try following slot - h1(x),

next probe - h1(x)+h2(x),

next probe h1(x)+2*h2(x) ........ h1(x)+n*h2(x)


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -