Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java, url to text : http://www.gutenberg.org/files/2600/2600-0.txt Write a program HashCodeSearch to search a file to see if you can find two words that have
In java,
url to text : http://www.gutenberg.org/files/2600/2600-0.txt
Write a program HashCodeSearch to search a file to see if you can find two words that have the same hash code. Read the file with a Scanner and use a data structure that maps the hashcode to a set of words with that hashcode. At the end print out words that have the same hash code on the same line in lexicographical order. (That will be any set with a length greater than 1) Finally print the number of duplicates divided by the number of words. It will be a really small number. That is the percentage of collisions Set the delimiter to use: scan.useDelimiter (" A-Za-z0-9 1+ The book to search is at the URL below. Download the plain text and save it in your roiect as "war and peace.txt". The book is War and Peace" - so there will be lots of words. (586,914). You can just declare that the main method throws FileNotFoundException. No need for a try/catchStep 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