Your code should call the above method with modifier taking on the values 0, 1, 2, 3, … as it runs through its probe sequence. The above code adds the square of the modifier to the hashCode of the object in order to find the probe location.

computer science

Description

Your code should call the above method with modifier taking on the values 0, 1, 2, 3, … as it runs through its probe sequence. The above code adds the square of the modifier to the hashCode of the object in order to find the probe location. (The hashCode % tableLength + tableLength expression in the above is used to make sure that the probe location is non-negative even when hashCode is negative. Using type long for the modifier ensures that there is no arithmetic overflow in the operations. Using % tableLength at the end makes sure that the probeIndex is less than tableLength.)


From Canvas download MySet.java, MyHashSet.java, TestHashSetsSmall.java, TestHashSets.java, and TimeHashSets.java. TestHashSetsSmall will test MyQuadraticHashSet on a very small test case. TestHashSets will test it on larger cases, comparing its results on the add, contains, and remove operations to the results of performing the same operations on a java.util.HashSet. Once your class successfully completes these tests, use TimeHashSets to compare its runtime performance to that of java.util.HashSet and MyHashSet (the textbook’s hash set class). 


The load threshold for your hash set is passed as a parameter to the class’s constructor. Another parameter passed to the constructor is an array of prime numbers that should be used as table sizes. This array is provided by the test programs. The first value in the array is 17, indicating that the table will initially have length 17. Proceed to the next value in the array each time you need to resize the table. Your class will be tested with load thresholds of 0.1 and 0.5. 


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.