Question

In: Computer Science

Consider inserting values 15, 22 and 29 in the order given intoa hash table of...

Consider inserting values 15, 22 and 29 in the order given into a hash table of size 7 with hash function h(x) = x mod 7. What will be the locations be the respective locations for 15, 22 and 29 in the hash table if quadratic probing is used to resolve colisions?


a.

1, 2, 4


b.

1, 2, 3


c.

1, 2, 0


d.

1, 1, 1

Solutions

Expert Solution

Quadtratic Probing:

If h(x)=x mod 7 is already occupied then we insert at the entry h(x)=(x + 1*1)mod 7 .

If h(x)=(x + 1*1) is already occupied then we insert at the entry h(x)=(x + 2*2)mod 7

At the i'th iteration we insert at h(x)=(x+i2)mod 7

Now look at solution.

15 mod 7= 1 so 15 will be at hash value 1

22 mod 7=1 here 1 is already occupied so apply quadratic probing and find new hash value for 22.

(22+1*1) mod 7=2 so 22 will be at hash value 2

29 mod 7=1 we know that 1 is already occupied so recalculate the hash value

(29 + 1*1)mod 7=2 we know that 2 is already occupied so recalculate the hash value for 29

(29+2*2)mod 7=5 so 29 will be stored at hash value 5.

There is no option correct.


Related Solutions

1.) Consider inserting values 15, 22 and 29 in the order given into a hash table...
1.) Consider inserting values 15, 22 and 29 in the order given into a hash table of size 7 with hash function h(x) = x mod 7. What will be the locations be the respective locations for 15, 22 and 29 in the hash table if quadratic probing is used to resolve colisions? a. 1, 2, 4 b. 1, 2, 3 c. 1, 2, 0 d. 1, 1, 1 2.) Consider the following sequences of addqs and removeqs, what order...
Consider inserting n distinct keys into a hash table with m buckets, where collisions are resolved...
Consider inserting n distinct keys into a hash table with m buckets, where collisions are resolved by chaining and simple uniform hashing applies. 1. What is the probability that none of the n keys hashed to a particular bucket? 2. What is the expected number of empty buckets? 3. What is the expected number of collisions?
Consider a sample with data values of 26, 25, 22, 17, 32, 33, 29, and 25....
Consider a sample with data values of 26, 25, 22, 17, 32, 33, 29, and 25. Compute the range, interquartile range, variance, and standard deviation (Round to 2 decimals, if necessary). Range Interquartile range Variance Standard deviation
Consider a sample with data values of 26, 25, 22, 16, 32, 33, 29, and 25....
Consider a sample with data values of 26, 25, 22, 16, 32, 33, 29, and 25. Compute the 20th, 25th, 65th, and 75th percentiles (to 1 decimal, if decimals are necessary).
Consider a sample with data values of 27, 24, 22, 16, 30, 35, 29, and 24....
Consider a sample with data values of 27, 24, 22, 16, 30, 35, 29, and 24. Compute the 20th, 25th, 65th, and 75th percentiles (to 1 decimal, if decimals are necessary).
Consider a sample with data values of 26, 25, 20, 15, 31, 33, 29, and 25....
Consider a sample with data values of 26, 25, 20, 15, 31, 33, 29, and 25. Compute the 20th, 25th, 65th, and 75th percentiles. 20th percentile 25th percentile 65th percentile 75th percentile
Draw each binary tree that is the maximum heap that results from inserting one by one in the order given the values 20, 15, 25, 30, 45, 18, 10, 12, 16.
In Java-Draw each binary tree that is the maximum heap that results from inserting one by one in the order given the values 20, 15, 25, 30, 45, 18, 10, 12, 16. Note that your tree diagram should show the heap after the maximum heap property has been restored. Submit nine diagrams.Next, draw each binary tree that is the maximum heap as each maximum value is deleted from the above tree and after the maximum heap property has been restored....
Consider a sample with data values of 27, 24, 22, 15, 31, 33, 28, and 24....
Consider a sample with data values of 27, 24, 22, 15, 31, 33, 28, and 24. Compute the range, interquartile range, variance, and standard deviation (Round to 2 decimals, if necessary).
Fill in the table Ch.2 Consider a sample with data values of 27, 25, 20, 15,...
Fill in the table Ch.2 Consider a sample with data values of 27, 25, 20, 15, 30, 34, 28, and 25. Compute the 20th, 25th, 63rd, and 73rd percentiles. If needed, round your answers to two decimal digits. Percentile Value 20% 25% 63% 73%
The following is a list of 29 Nascar racers, arranged in descending order. 18, 21, 22,...
The following is a list of 29 Nascar racers, arranged in descending order. 18, 21, 22, 25, 26, 27, 29, 30, 31, 33, 36, 37, 41, 42, 47, 52, 55, 57, 58, 62, 64, 67, 69, 71, 72, 73, 74, 76,77 -Find the % for the data value 74. -Find the % for the data value 30 -Calculate the 44th percentile -Calculate the 7th percentile
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT