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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started