Question

5. Below is an array with 15 positions, which is used as a hash table to keep some IDs. The key to each record is the 3-digit
Please Answer as soon as possible. Thank you so much.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer followed by explanation:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
24 120 17 78 146 189 114 42 282

Using a similar approach as used in inserting the first 4 elements we can insert the rest of the elements:

120: h(120) = 0. This is filled. Apply double hashing:

h(120) + 1.h2(120) = 0 + 1 = 1 which is empty hence 120 goes to position 1.

78: h(78) = 3 which is empty hence it goes to index 3.

114: h(114) = 9 . Filled:

h(114) + 1. h2(114) = 11 mod 15 = 11. Empty Hence 114 goes to 11.

146: h(146) = 11. Filled

h(146) + h2(146) = 11 + 6 mod 15 = 17 mod 15 = 2. Filled

h(146) + 2. h2(146) = 11 + 12 mod 15 = 23 mod 15 = 8. Empty Hence 146 goes to 8

282: h(282) = 12. Filled

h(282) + 1.h2(282) = 12 + 2 = 14 mod 15 = 14. Empty Hence 282 goes to index 14.

Finally, Hence the table looks like:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
24 120 17 78 146 189 114 42 282

You can comment below the answer, for any doubts, and I will be happy to help!

Please give a thumbs up if my answer could be of help!

All the best!

Add a comment
Know the answer?
Add Answer to:
Please Answer as soon as possible. Thank you so much. 5. Below is an array with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Part 5. Suppose that your hash function resolves collisions using the open addressing method with double...

    Part 5. Suppose that your hash function resolves collisions using the open addressing method with double hashing. The double hashing method uses two hash functions h and h'. Assume that the table size N = 13, h(k) = k mod 13, h'(k) = 1 + (k mod 11), and the current content of the hash table is: 0 1 2 3 6 7 8 9 10 11 12 4 17 5 98 If you insert k = 14 to this...

  • 5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and...

    5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and the hash function h(x) = x mod 5. i. (1) Pick 8 random numbers in the range of 10 to 99 and write the numbers in the picked sequence. Marks will only be given for proper random numbers (e.g., 11, 12, 13, 14 ... or 10, 20, 30, 40, .. are not acceptable random sequences). ii. (2) Draw a sketch of the hash table...

  • This should be in Java Create a simple hash table You should use an array for...

    This should be in Java Create a simple hash table You should use an array for the hash table, start with a size of 5 and when you get to 80% capacity double the size of your array each time. You should create a class to hold the data, which will be a key, value pair You should use an integer for you key, and a String for your value. For this lab assignment, we will keep it simple Use...

  • ZOOM Page 7. Apply the following operations on the following Quadratic probing haslh table. Write down all your calculations and changes to the hash table Hashi (key): key % 16 Hash2(key): 11-key % 1...

    ZOOM Page 7. Apply the following operations on the following Quadratic probing haslh table. Write down all your calculations and changes to the hash table Hashi (key): key % 16 Hash2(key): 11-key % 11 Double hashing probing sequence (Hashi (key) + i * Hash2(key)) % 16 149 3 88 a. (5 points)HashInsert(Table, 17) 6 16 7 23 8 24 10 42 12 99 13 14 15 b. (5 points)Hashremove(Table,16) ZOOM Page 7. Apply the following operations on the following Quadratic...

  • in C++ Code should work for all cases In this assignment you are requested to implement...

    in C++ Code should work for all cases In this assignment you are requested to implement insert, search, and delete operations for an open-addressing hash table with double hashing. Create an empty hash table of size m= 13. Each integer of the input will be a key that you should insert into the hash table. Use the double hashing function h{k, i) = (hı(k) + ih2(k)) mod 13 where hi(k)= k mod 13 and h2(k) = 1+(k mod 11). The...

  • I need help for Q11 Please if you can, answer this question too. I need B...

    I need help for Q11 Please if you can, answer this question too. I need B Q11. A complete graph is a graph where all vertices are connected to all other vertices. A Hamiltonian path is a simple path that contains all vertices in the graph. Show that any complete graph with 3 or more vertices has a Hamiltonian path. How many Hamiltonian paths does a complete graph with n vertices has? Justify your answer Q1. Draw thee 13-entry hash...

  • Please answer this problem in C++, Thank you! Read and study the sample program: "hashing with chaining using singly...

    Please answer this problem in C++, Thank you! Read and study the sample program: "hashing with chaining using singly linked lists", as well as "hashing with chaining using doubly linked lists". Notice this program is complete except it doesn't include the remove function. Write the remove function and test it with the rest of the program including the given main program. Upload your C++ source file. ---Here is the referenced program: "hashing with chaining using singly linked lists". Below this...

  • C programming Let's try to use the template below to implement a Set with double hashing....

    C programming Let's try to use the template below to implement a Set with double hashing. Here we assume the Set contains names with 3 characters long. Since it is a Set, we do not need to have an explicit value for each key. We will use a token value of 1 if a name belongs to the Set. Let's reuse the exact hash functions we have seen in example in Part 7 of the lecture notes, page 3. As...

  • C programming Problem 3 [Set via Hashing] As mentioned in the lecture, a hash table can...

    C programming Problem 3 [Set via Hashing] As mentioned in the lecture, a hash table can be used to implement a Set ADT. Let's try to use the template below to implement a Set with double hashing. Here we assume the Set contains names with 3 characters long. Since it is a Set, we do not need to have an explicit value for each key. We will use a token value of 1 if a name belongs to the Set....

  • Need help as soon as possible please!! per unit data for these products appear below. Item...

    Need help as soon as possible please!! per unit data for these products appear below. Item D Item E Item F Item G Item H Item I $142 $130 $112 $106 $130 106 59 42 35 35 12 24 94 35 35 30 1 12 21 Cost to complete 12 2 Using the LCNRV rule, determine the proper unit value for balance sheet reporting purposes at December 31, 2017, for each of the inventory items above. ttem E s Item...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT