Using the modulodivision method and linear probing store the
Using the modulo-division method and linear probing, store the keys shown below in an array with 19 elements. How many collisions occurred? What is the density of the list after all keys have been inserted?
224562 137456 214562
140145 214576 162145
144467 199645 234534
Solution
224562%19=1 (Assigning to slot 1)
140145%19=1 (As collosion occured and it is linear probing assing it to slot 2)
144467%19=10 (Assigning to slot 10)
137456%19=10 (As collosion occured and it is linear probing assing it to slot 11)
214576%19=9 (Assigning to slot 9)
199645%19=12 (Assigning to slot 12)
214562%19=14 (Assigning to slot 14)
162145%19=18 (Assigning to slot 18)
234534%19=17 (Assigning to slot 17)
Only 2 collosion had occured
9/19=0.47 is the density of the has table
