Problem
Simulate filling a Hash table with random numbers(rand()) ranging from 1-100. And observe how it fills. Your hash table should have an N of 19, meaning 19 indexes, and use Chaining to resolve collisions.
Run 100 simulations (a loop might help) and calculate the following, to three decimal places:
1) What is the average number of inserts before the first collision?
2) What is the average number of inserts the first chain of length 19 is fully filled (In the same index, 19 collisions occurred)?
3) What is the average number of inserts, so you have a Load Factor 0.9(18 out of 19 indexes are filled)?
4) What is the average number of inserts, so you have a Load Factor 1.0(all the 19 indexes are filled)?