In: Computer Science
SHOW WORK
Draw the hash table that results using the hash function: h(k)=kmod7 to hash the keys 41, 16, 40, 47, 10, 55. Assuming collisions are handled by Double hashing.
SHOW WORK
Solution for above task
Hash position = Input Value % Table Size
Attempting to insert 41 at position 6.
Inserting 41 at position 6.
Hash position = Input Value % Table Size
Attempting to insert 16 at position 2.
Inserting 16 at position 2.
Hash position = Input Value % Table Size
Attempting to insert 40 at position 5.
Inserting 40 at position 5.
Hash position = Input Value % Table Size
= 5-(47%5) = 3 Positions from 5
Attempting to insert 47 at position 5.
Attempting to insert 47 at position 2.
Attempting to insert 47 at position 6.
Attempting to insert 47 at position 3.
Inserting 47 at position 3.
Hash position = Input Value % Table Size
= 5-(10%5) = 5 Positions from 3
Attempting to insert 10 at position 3.
Attempting to insert 10 at position 6.
Attempting to insert 10 at position 2.
Attempting to insert 10 at position 5.
Attempting to insert 10 at position 1.
Inserting 10 at position 1.
Hash position = Input Value % Table Size
= 5-(15%5) = 5 Positions from 1
Attempting to insert 15 at position 1.
Attempting to insert 15 at position 5.
Attempting to insert 15 at position 2.
Attempting to insert 15 at position 6.
Attempting to insert 15 at position 3.
Attempting to insert 15 at position 0.
Inserting 15 at position 0.
The final Hash Table is
Thank You
Don't forgot to give rating.