You should write a program that will analyze the impact of varying the load factor of the HashSet when used to store the dictionary file used in Lab 4.
Your program should generate all of the results for the following table:
| Load Factor | # of collisions | # of empty buckets | Maximum # of elements in a bucket |
| 0.25 | |||
| 0.50 | |||
| 0.75 | |||
| 0.99 |
You should assume that the capacity of the HashSet is doubled whenever the load factor is exceeded.
You will not be able to use the HashSet to do your tests. You should use either an array or an ArrayList instead.
Create four new classes that contain a String as a field and override the hashCode() method. For each new class, generate another table similar to the one above. Your revised hashCode() methods should calculate the hash code as follows:
Although the XML template file includes the tables, you may find it easier to programmatically generate the tables and then paste the program output into your report.
Here is a template file to use as a starting point for this report.
Your report should include:
As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.
If you have any questions, consult your instructor.
This assignment was originally developed by Dr. Chris Taylor.
| © 2001-2006 Dr. Christopher C. Taylor | Office: CC-36C | Phone: 277-7339 |