Question

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Given a hash table T with m slots that stores n elements, we define the load factor for T as n/m, that is, the average number of elements stored in a chain.

Here we want average length of chain to be 3 so load factor is 3.

B)

N=1000

Load factor =3

N/m=3

M=334

So we 334 slots in our hash table  

THUMBS UP IF YOU ARE SATISFIED WITH ANSWER OTHERWISE REPLY WITH YOUR CONCERN  

Add a comment
Know the answer?
Add Answer to:
Suppose we wish to allocate a hash table, with collisions resolved by chaining, to hold roughly...
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
  • Exercise 3 (5 points). Suppose we have a hash table of m = 9 slots, and...

    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.

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

  • 3. (03] (10 pts) We are to design a hash table for n = 1000 elements....

    3. (03] (10 pts) We are to design a hash table for n = 1000 elements. On average, suc- cessful searches should require no more than 2 element examinations and unsuccessful searches should examine no more than 8 elements. Assuming that we have a simple uniform hash function that uses the division method, what is the minimum hash table size if we use chaining? Assume that each element takes 10 bytes of storage and each pointer takes 4 bytes.

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

  • 0. Introduction. This involves designing a perfect hash function for a small set of strings. It...

    0. Introduction. This involves designing a perfect hash function for a small set of strings. It demonstrates that if the set of possible keys is small, then a perfect hash function need not be hard to design, or hard to understand. 1. Theory. A hash table is an array that associates keys with values. A hash function takes a key as its argument, and returns an index in the array. The object that appears at the index is the key’s...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

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