Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. I have posted a file words.dat containing 5,757 5-letter words. (This file was created by Donald Knuth, a Turing award winning computer and these
2. I have posted a file words.dat containing 5,757 5-letter words. (This file was created by Donald Knuth, a Turing award winning computer and these were all valid 5-letter English words at the time at which the file was created.) Now suppose that you want to create a hash table to store these words (a) Using ideas from our example of constructing a hash function for storing 250 IP addresses (in lecture, Tue Feb 6th), construct a hash function for storing these 5- letter words in a hash table. Recall that the first step in designing your hash function is deciding how large you want the hash table to be. Describe your hash function as clearly as you can. (b) Write a program that that reads from words.dat and uses your hash function to hash words into hash table slots. You don't have to explicitly store words in the hash table. I am only interested in knowing if your hash function has been able to spread the words out in the hash table. To help me understand this, output the average number of words that hashed to a non-empty slot and the maximum number of words that hashed to a slot. 2. I have posted a file words.dat containing 5,757 5-letter words. (This file was created by Donald Knuth, a Turing award winning computer and these were all valid 5-letter English words at the time at which the file was created.) Now suppose that you want to create a hash table to store these words (a) Using ideas from our example of constructing a hash function for storing 250 IP addresses (in lecture, Tue Feb 6th), construct a hash function for storing these 5- letter words in a hash table. Recall that the first step in designing your hash function is deciding how large you want the hash table to be. Describe your hash function as clearly as you can. (b) Write a program that that reads from words.dat and uses your hash function to hash words into hash table slots. You don't have to explicitly store words in the hash table. I am only interested in knowing if your hash function has been able to spread the words out in the hash table. To help me understand this, output the average number of words that hashed to a non-empty slot and the maximum number of words that hashed to a slot
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started