Question
Create a hash table of size 121. Put 1 00 words into it using the file words_no_duplicates.txt. Handle collisions by LINEAR PROBING. You should have
Create a hash table of size 121. Put 100 words into it using the file words_no_duplicates.txt. Handle collisions by LINEAR PROBING.
You should have a method to add each word to the table. You should also count the average number of accesses to find all the words. Note: when you insert using linear probing you can count as you insert. Then you need another method to count the average number of accesses to find that a word is NOT in the table. You will need to first build the table and then run this last method.
NOTE: DO NOT use the Hash class that Java provides. I want you to do this using just an array. BUT it doesn't have to be an array of strings. If it helps you to put an object into the array that holds more than the string, that's OK. Not saying you have to - there are several ways to write this program, the output will be the same.
NOTE: I asked you to use just the first 100 words of the file with no duplicates because some students may run out of RAM. I also purposely chose a bad hash function that creates lots of duplicates.
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