Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Help In Java!! Create a hash table of size 121. Put 1 00 words into it using the file words_no_duplicates.txt. Handle collisions by LINEAR

Please Help In Java!!

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. I will post the answers to the number of probes shortly (so you know if you are correct).

Here are my answers. Let me know if I'm wrong...

The total number of probes in a successful search is 3127 The average number of probes in a successful search is 31.27 The total number of probes in an unsuccessful search is 4880 The average number of probes in an unsuccessful search is 40.33057851239669

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. What are the major sources of stress in your life?

Answered: 1 week ago

Question

What tools might be helpful?

Answered: 1 week ago