Question

Suppose we are inserting strings into a hash table

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

1.

0
1
2
3 "Bartholomew"
4 "Fred"
5 "Chloe"
6 "Adam"
7 "Rebecca"
8 "Reggie"

When filled in ordered mentioned, we get table as above. Linear Probed values are marked in bold.

2.

0
1 "Adam"
2
3 "Bartholomew"
4 "Fred"
5 "Chloe"
6 "Reggie"
7 "Rebecca"
8

When filled in ordered mentioned, we get table as above. Values where secondary hash function is required, are marked in bold.

Add a comment
Know the answer?
Add Answer to:
Suppose we are inserting strings into a hash table of size 9. Suppose we have two...
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
  • Question 8: (a) We create a Hash Table of size 7, using open addressing and linear...

    Question 8: (a) We create a Hash Table of size 7, using open addressing and linear probing with the hash function h(n)=n%7. Write the content of the array after inserting the following values in sequence: 11, 28,46, 7,67, 88,0. (3 marks) . loj [1] [2] [3] [41-5] 问 (b) Explain the issue linear probing has and how it can be addressed. (3 marks)

  • 4. Hashing and Hash Tables. You need to use the ASCII table in the last page for this question. Study the following hash functions for ASCII C strings that are at least 3-char long unsigned hash1(con...

    4. Hashing and Hash Tables. You need to use the ASCII table in the last page for this question. Study the following hash functions for ASCII C strings that are at least 3-char long unsigned hash1(const char, unsigned unsigned vto]+01997 return (v % m); unsigned hash2Cconst char unsigned) unsigned v-o]k(2] 877 return 1 + (v % ( -1)); (a) Given that m-, 7, compute the hash values and fill the following table (3%) String k hash1k, ) hash2(k, 7) aph...

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

  • please use Java!! We are storing the inventory for our fruit stand in a hash table....

    please use Java!! We are storing the inventory for our fruit stand in a hash table. The attached file shows all the possible key/fruit combinations that can be inserted into your hash table. These are the real price lookup values for the corresponding fruit. Problem Description In this programming assignment, you will implement a hash table class fruitHash. Your hash table must include the following methods: 1) hashFunction(key) This method takes a key as an argument and returns the address...

  • Suppose you have the following hash table, implemented using linear probing. The hash function we are...

    Suppose you have the following hash table, implemented using linear probing. The hash function we are using is the identity function, h(x) = x. 0 1 2 3 4 5 6 7 8 9 8 12 3 14 4 21 In which order could the elements have been added to the hash table? There are more than one correct answers, and you should give all of them. Assume that the hash table has never been resized, and no elements have...

  • Hash Tables. (Hint: Diagrams might be helpful for parts a) and b). ) When inserting into...

    Hash Tables. (Hint: Diagrams might be helpful for parts a) and b). ) When inserting into hash table we insert at an index calculated by the key modulo the array size, what would happen if we instead did key mod (array_size*2), or key mod (array_size/2)? (Describe both cases). Theory answer Here Change your hashtable from the labs/assignments to be an array of linkedlists – so now insertion is done into a linkedlist at that index. Implement insertion and search. This...

  • design hash table Suppose you need to design a hash table. The keys themselves are (pointers...

    design hash table Suppose you need to design a hash table. The keys themselves are (pointers to) C-style zero-terminating strings, so the string "foobar" occupies seven bytes. You are interested in minimizing the space used while keeping search time within reasonable bounds. You expect to store 1000 names with (on average) 7 letters each. If, for example, you choose separate chaining with 2000 buckets, the space required will be 24000 bytes: 8000 = (2000 buckets times 4 bytes per bucket...

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

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

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