Homework 9

This homework is about inserting, searching and deleting items in a hash table. Use 100 buckets, the hash function f(x)= x mod 100 and linear probing.

1. Insert the following items: 6833 24188 21355 5927 19471 29205 3921 21222 12490 10493 1744 26342 16326 23748 8632 12806 6725 31599 24884 30401 32527 912 26120 19804 3725 9025 15648 13440 4444 30459 29218 11277 21879 17805 17204 8582 14242 21126 29804 26732 31619 31548 20306 15178 22528 28938 27984 29253 27770 20101 26886 27529 21013 20239 14565 24738 29264 30213 5410 941
How many buckets did you look at, in total?
How does your hash table look like at the end?

2. Search for the following items: 17936 20239 22150 13440 26748 14565 25859 17204 32358 26732 4602 19804 30165 14242 2794 21355 7851 29253 30457 19804
Where in the hash table does it sit?
How many buckets did you look at, in total?

3. We want to delete the following items: 21126 19804 21879 26120 30401
To delete x, does "simply setting the slot previously occupied by x to empty" solve the problem?
Does the search algorithm have to be modified so that a correct search is made in the situation when deletions are permitted?
Where can a new identifier be inserted?

If you delete above elements, how many buckets did you look at, in total?
How does your hash table look like at the end?