Question: Write a simple C++ program which will identify how many collisions occur for each of the numbers from 200 thru 600, incremented by 5, when

Write a simple C++ program which will identify how many collisions occur for each of the numbers from 200 thru 600, incremented by 5, when mapping to a hash table array of 100 entries.

Do this by creating a variable and looping to force it to have all values: 200, 205, 210 600.

First use 100 as the divisor and use the modulo function to do mapping. Then use 101 as the divisor with the modulo function to do the mapping.

Separately, set up an array of 100 entries, whose values will be a count of the number of times its index is created. Initialize to zero.

For example: 200 maps to index value i = 99. Add 1 to Array[99].

Output the 101 results to see how the distribution would occur.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!