CPE 103 Programming Project

HashMap

This project is a continuation of the FamousNames project.  The goal is to see how much faster our application will execute if we use a hash table instead of a binary search tree. In theory it should be noticeably faster.

1. Measure the execution time of your FamousName program to process the instructor's list of 170,000 famous names.  There is an undocumented command line argument in the instructor's application class.  If you provide the filename followed by a "-t" the program will display the elapsed time to execute the makeReport() method. 

Unix commands and example run (with hypothetical results):
javac -cp +libs/FamousNameComponents.jar:. *.java
java -cp +libs/FamousNameComponents.jar:. FamousNameApp famousnames.txt -t
Elapsed time (secs): 5.356
Report length is 2467

2, Create a new project, and copy all the project files into the new folder. Remove BinaryNode and BinarySearchTree.
3. Modify the Document class so it uses java.util.HashMap instead of BinarySearchTree.  There is one small change to the javadocs.  The list returned by getNameCounts() will not be alphabetized, because a HashMap doesn't maintain any ordering.  So the final report will be ordered by frequency only.

4. You will find it necessary to make a one or two other small changes. Be sure your finished program produces the same results as part 1, except ordered by frequency only. 

5. When your program runs, use the "-t" flag to measure how long it takes to process the same list of famous names. 

6. Create a short report that includes the experimental observations you made and an explanation of the results. You may email your report as a PDF to the instructor or bring it to office hours.

Testing

Modify your JUnit tests you wrote for the previous project.

Your components will be tested with instructor reference tests.  Importantly there will be a performance test: the 34,000 names from the online database. There's a time limit of 2 seconds.

On this project your solution must conform to the class coding standard. Your unit tests must demonstrate "statement" coverage (they cause every statement in your program to be executed.)


Handing in Your Source Electronically