Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a WordCount class (and any necessary helper classes) : Write a Hash Table class (and any necessary helper classes): Separate chaining is the strategy

Write a WordCount class (and any necessary helper classes):

image text in transcribed

Write a Hash Table class (and any necessary helper classes): Separate chaining is the strategy used to handle collision, which means the structure of the Hash Table looks like the picture below (see the Hash Table ADT lectures). The hash table size must be variable (not hard coded) according to user input, so that you can test with a variety of values. Keys will be the words from the input file and the values will be a count (of their occurrences). Method for converting a key to its hash code is up to you, but a simple option is to sum the UNICODE VALUE of each character. You may wish to enhance the calculation by accounting for the position of each character in the key. Make sure to account for case (i.e., do you consider upper and lower case to be equivalent?). You must have separate methods for calculating hashCode() and hashIndex(). For example: Key "The" Hash code = (int) 'T', + (int) 'h', + (int) 'e' = 84 + 104 + 101 = 289 Hash index = Hash code compressed to table size As usual, provide constructors and mutator and accessor methods for all instance variables, plus toArray() and toString() methods. Your unit testing (use main() and utility methods in HashTable.java) must be thorough - test all methods

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago