BELOW IS MY CODE: Hashtable with Quadratic Probing Implement a Java class of has
ID: 3789810 • Letter: B
Question
BELOW IS MY CODE:
Hashtable with Quadratic Probing Implement a Java class of hashtables using quadratic probing for collision resolution. The objects to be stored in the table are key-value pairs The keys are strings, and the values are integers The table sizes, m, are prime numbers. The first size should be 1031. Let n be the number of items in the table. When n m/2, you use the technique of dynamic arrays to enlarge the table You want to approximately double the table size but keep to the primes Use these primes: 2063 127, 8263, 16529, and 33071. You will not need larger primes for the purpose of this homework You may use Java String hashCode() as the hash function. The following is what you do for collision resolution. Let b be the hash value modulo m. If bucket b is occupied, you probe (b+12) m, (b-+22) m, (b- 32) m (b- 2)2) m, and stop as soon as you find an empty bucket. As long as n is kept less than m you will find an empty bucket by the end of the probing Use this page https docs oracle com avase/8/docs/api ava/util/Hashtable .html as a template for your class, but you do not need to implement all the methods. Implement as many as necessary to accomplish the following task 2 word Frequencies in a Text File Implement a Java program that counts word frequencies in a text file. Use a hashtable to store the data the words are the keys, and their frequencies are the values. The output of the program is the complete list of all the words and their frequencies in descending order of frequencies when two words have the same frequency, output them by alphabetical order. Each line of output consists of a word, a tab, and the frequency A sample input is "The Tragedy of Hamlet, Prince of Denmark", in the file Hamlet.txt. When processing the text, you should keep just the words, and discard all punctuation marks, digits, and so on. You also need to turn all upper case letters to lower cases.Explanation / Answer
The map abstract data type is defined as follows. The structure is an unordered collection of associations between a key and a data value. The keys in a map are all unique so that there is a one-to-one relationship between a key and a value. The operations are given below.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.