CMSC 206: Data Structures
Assignment#4
Due on Thursday, October 26, 2017
New deadline: Tuesday, 0ctober 31.
In this exercise, we will essentially do something similar to your Assignment#3 but embellish in two ways:
- Use your own implementation of ArrayList to store the dataset.
- Many towns have several zip codes. For example, Cambridge, MA has five zip codes, Buffalo, NY has over 40 zipcodes. Each zipcode may have its population data. Write your program to aggregate the population data for each zipcode in a town when printing results.
Query: Cambridge, MA
Found...
Town: Cambridge, MA, 02138 (Plus 6 other zipcodes)
Population: 105321 (54134 Female, 51187 Male)
For demonstrating the correctness of your program, test your program for the follwoing inputs:
- Cambridge, MA
- Philadelphia, PA
- Seattle, WA
- Pie Town, NM
- Surprise, NY
- Romance, AR
- San Francisco, CA
- Okay, OK
- Accident, MD
- Buffalo, NY
Once you have completed the program, as in Assignment#3,use it to count the number of comparisons needed to answer a query. Then, for the input data above, compute and output the following:
- the number of comparisons needed to answer each query
- the average number of comparions needed
to answer a query
- the average number of comparisions needed to answer a successful
query
- the average number of comparisons needed to answer an unsuccessful query
To show your output you may cut and paste the contents of the Console Window in a text/Word file and print it. Additionally, hand in a prinout of the complete Java program.
What to Hand-in:
- A complete printout of the latest version of your program(s)
- A prinout of your program showing the outputs from the queries above and the comparison data as described above
Back to CS206 Course Materials