Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a program that will find out how many uniquewords appear in the text of a book, and for each word, find out howmany times
Develop a program that will find out how many uniquewords appear in the text of a book, and for each word, find out howmany times it is used. The words will be located in a textfile. The user will specify the name of the text file, or youmay allow the name to be a command-line argument. If the file failsto open, enter into dialog with the user to get the name of a filethat can be opened. Ignore all punctuation in thetext file not associated with a word. That is, ignore periods,commas, semicolons, colons, various parentheses, and exclamationpoints, as well as punctuation I haven't thought to mention. Do keep the apostrophe in can't. Treat words with apostrophes asdifferent unique words so that "street" is different from"street's"; also, treat plurals as different from their singularsand the various forms of verbs as different — this is a hashtable exercise, not a natural language parsing exercise.You may also treat numbers as words.
- Total number of collisions on insertions. A collision occurs when a word hashes to a location alreadyoccupied by another word. Hint: this means that theHashTable object requires a field to accumulate the totalcollisions when a word has not yet been entered into thetable.
- Average number of collisions per wordplacement. This is just the total number of collisionsdivided by the words placed into the hash table. Hint:this means that the HashTable object also requires a field toaccumulate the total words in the table.
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