Question

In: Computer Science

SHOW WORK Draw the hash table that results using the hash function: h(k)=kmod7 to hash the...

SHOW WORK

Draw the hash table that results using the hash function: h(k)=kmod7 to hash the keys 41, 16, 40, 47, 10, 55. Assuming collisions are handled by Double hashing.

SHOW WORK

Solutions

Expert Solution

Solution for above task

Hash position = Input Value % Table Size

  • Hash position = 41 % 7 = 6

Attempting to insert 41 at position 6.

Inserting 41 at position 6.

Hash position = Input Value % Table Size

  • Hash position = 16 % 7 = 2

Attempting to insert 16 at position 2.

Inserting 16 at position 2.

Hash position = Input Value % Table Size

  • Hash position = 40 % 7 = 5

Attempting to insert 40 at position 5.

Inserting 40 at position 5.

Hash position = Input Value % Table Size

  • Hash position = 47 % 7 = 5(Collision)

= 5-(47%5) = 3 Positions from 5

Attempting to insert 47 at position 5.

Attempting to insert 47 at position 2.

Attempting to insert 47 at position 6.

Attempting to insert 47 at position 3.

Inserting 47 at position 3.

Hash position = Input Value % Table Size

  • Hash position = 10 % 7 = 3(Collision)

= 5-(10%5) = 5 Positions from 3

Attempting to insert 10 at position 3.

Attempting to insert 10 at position 6.

Attempting to insert 10 at position 2.

Attempting to insert 10 at position 5.

Attempting to insert 10 at position 1.

Inserting 10 at position 1.

Hash position = Input Value % Table Size

  • Hash position = 15 % 7 = 1(Collision)

= 5-(15%5) = 5 Positions from 1

Attempting to insert 15 at position 1.

Attempting to insert 15 at position 5.

Attempting to insert 15 at position 2.

Attempting to insert 15 at position 6.

Attempting to insert 15 at position 3.

Attempting to insert 15 at position 0.

Inserting 15 at position 0.

The final Hash Table is

Thank You

Don't forgot to give rating.


Related Solutions

3. Draw the hash table that results using the hash function: h(k)=kmod 7 to hash the...
3. Draw the hash table that results using the hash function: h(k)=kmod 7 to hash the keys 50, 700, 76, 85, 92, 73, 101. Assuming collisions are handled by Quadratic probing. Don't write a program. Just please manually solve the problem. Thanks.
3. Assume a hash table with 7 locations and the hashing function h(i) = i%7. Show...
3. Assume a hash table with 7 locations and the hashing function h(i) = i%7. Show the hash table that results when the integers are inserted in the order given. (10 points each. Total 30) • 5, 11, 18, 23, 28, 13, 25, with collisions resolved using linear probing • 5, 11, 18, 23, 28, 13, 25, with collisions resolved using quadratic probing • 5, 11, 18, 23, 28, 13, 25, with collisions resolved using chaining.
Develop an algorithm to demonstrate hashing using hash table with modulo as the hash function. Assume...
Develop an algorithm to demonstrate hashing using hash table with modulo as the hash function. Assume the size of the hash table as 10. To avoid collisions in case of identical keys for two different elements, use Linear Probing collision resolution technique. using c++ add comment on the code
In C++ Use vectors instead of linked lists Create a Hash table program using H(key) =...
In C++ Use vectors instead of linked lists Create a Hash table program using H(key) = key%tablesize with Chaining and Linear probing for a text file that has a list of 50 numbers Ask the user to enter the file name, what the table size is, and which of the two options they want to use between chaining and linear probing
Using different K salts in the uptake media results in different H+ flux from the barley...
Using different K salts in the uptake media results in different H+ flux from the barley roots. Why? The K salts in question are KCl and KSO4.
Assume that you are hashing key K to a hash table of n slots (indexed from...
Assume that you are hashing key K to a hash table of n slots (indexed from 0 to n - 1). For each of the following functions h(K), answer the following question(s): 1) Is the function acceptable as a hash function (i.e., would the has program work correctly for both insertions and searches), 2) and if so, is it a good hash function? Function rand(n) returns a random integer between 0 and n - 1. Also assume k is a...
Determine the convergence or divergence if each integral by using a comparison function. Show work using...
Determine the convergence or divergence if each integral by using a comparison function. Show work using the steps below: A. Indicate the comparison function you are using. B. Indicate if your comparison function is larger or smaller than the original function. C. Indicate if your comparison integral converges or diverges. Explain why. D. State if the original integral converges or diverges. If it converges, you don’t need to give the value it converges to. 16. integral from 0 to 1((e^(-x))/(√x))...
Which memory locations are assigned by the hashing function h(k) = k mod 97 to the...
Which memory locations are assigned by the hashing function h(k) = k mod 97 to the records of insurance company customers with these Social Security numbers? (a) 034-56-7981 (b) 220-19-5744 (c) 183-21-1232
Answer & show work andswer and show work answer n show work Using a sample of...
Answer & show work andswer and show work answer n show work Using a sample of 20 people, the testing agency found that 14 of them had better protection than that provided by the competitor. Do you have enough evidence to say/claom that your suncreen lotion provides better protection than the competitiors in a majority of cases? Use alpha = 0.01 to answer. 1. What are the apporiate hypotheses for situation? 2. the appropriate rejection rule is? 3. the calculated...
1.Consider hashing with a table size of 100 and a hash function of key%tablesize. Insert 25...
1.Consider hashing with a table size of 100 and a hash function of key%tablesize. Insert 25 keys. Do you expect to see any collisions? Why or why not? Yes, because random values likely will land on same locations. No becase there are four times as many slots as needed. 2. Secondary clustering means that elements that hash to the same position will probe to the same alternate cells. Simple hashing uses key%tablesize as the hash function. Which of the following...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT