Question

Exercise 3 (5 points). Suppose we have a hash table of m = 9 slots, and we resolve collisions by chaining. Demonstrate what happens when we insert the keys 5, 28, 19, 15, 20, 33, 12, 17, 10. Use the division-method hash function h (k) = k mod 9.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Exercise 3 (5 points). Suppose we have a hash table of m = 9 slots, and...
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
  • Suppose we use the hash function h(x) = x mod 7 (i.e. h(x) is the remainder...

    Suppose we use the hash function h(x) = x mod 7 (i.e. h(x) is the remainder of the division of x by 7) to hash into a table with 7 slots (the slots are numbered 0, 1,…, 6) the following numbers: 32, 57, 43, 20, 28, 67, 41, 62, 91, 54. We use chaining to handle collisions. Which slot contains the longest chain?

  • Assume a Hash table has 7 slots and the hash function h(k) = k mod 7...

    Assume a Hash table has 7 slots and the hash function h(k) = k mod 7 is used. The keys 14, 3, 11, 6, 10, 4, 20, and 17 are inserted in the table with collision resolution by chaining. Assume that the keys arrive in the order shown. (a) Show the hash table obtained after inserting all 8 keys. [Show only the final table] (b) Under the assumption that each key is searched with probability 1/8, calculate expected number of...

  • 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...

  • Suppose we wish to allocate a hash table, with collisions resolved by chaining, to hold roughly...

    Suppose we wish to allocate a hash table, with collisions resolved by chaining, to hold roughly n=1000 character strings and we don’t mind examining an average of 3 elements in an unsuccessful search. If we choose the division method to design the hash function: 1) What is the load factor? 2) What value of 'm' should be picked? (m is the number of slots in the hash table) Explain briefly why you pick this m.

  • 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...

  • 3. Assume that you have a seven-slot hash table (the slots are numbered 0 through 6)....

    3. Assume that you have a seven-slot hash table (the slots are numbered 0 through 6). Show the final hash table that would result if you used the following approach to put 7, 13, 10,6 into the hash (4 points each) the hash function h(k)-k mod 7 and linear probing function the hash function h(k)-k mod 7 and quadratic probing (a) (b)

  • 11. (10 Points) Draw the final result after inserting keys 24, 25, 50, 38, 12, 90...

    11. (10 Points) Draw the final result after inserting keys 24, 25, 50, 38, 12, 90 into a hash table with collisions resolved by (a) linear probing, (b) chaining. Let the table have 13 slots with addresses starting at 0, and let the hash function be h(k) k mod 13 (a) (5 Points) Linear Probing 0 1 2 3 4 5 6 789 10 11 12 [ANSWER] (b) (5 Points) Separate Chaining ANSWER]

  • It should be really short and simple to do this. #1 [8 points) Sketch a hash...

    It should be really short and simple to do this. #1 [8 points) Sketch a hash table of size N=11, where the hash function is hash(key) = key mod N and chaining is used to resolve collisions, when the following elements are inserted: 20, 42, 45, 49, 62, 72,95 0 1 2 3 4 5 6 7 8 9 10 What is the size of the largest bucket? — #2 [7 points) Sketch a hash table of size N=11, where...

  • 1. Using closed hashing with double hashing to resolve collisions insert the following keys into a...

    1. Using closed hashing with double hashing to resolve collisions insert the following keys into a table with 11 slots, numbered 0 through 10. The hash functions to be used are H1(k)k(mod11) and H2(k)- Rev(k + 1) (mod11) The function REV reverses the decimal digits like Rev(376) 673. Show the hash table after all nine keys have been inserted. Be sure to indicate how H1 and H2 are used. Keys: 4, 3, 2, 8, 33, 17, 24, 35, 46

  • 11. Dra The size The hash function used is: the contents of the 13 hash tables...

    11. Dra The size The hash function used is: the contents of the 13 hash tables below. Show your work for partial r hash table is HOk)-k mod 7 13, 17, 6, 24, 3 a) Resolve collisions with chaining b) Double hashing, where W20)-7-0mod 5) 0 1 1 2 2 3 3 4 4 5 5 6 6 c) What is the load factor for the table a? d) What is the load factor for the table b? f) Is...

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