- Case StudyHelp.com
- Sample Questions
CMP561 Quiz #2 Page 1
CMP 561 Design & Analysis of Algorithms Dr. Yao
Quiz #2 One submission per team.
Resource to Study:
StateSearch.java (data file name: addressfile.txt)
Task: Your team is tasked to develop a program to compare the CPU efficiency and Memory efficiency among 3 data structures: java.util.ArrayList, java.util.Vector, and static array used in implementing a solution to the requirements described below. This program DOES NOT take any input from the user at all. Name your drive class as TeamNumber QZ2, for example, Team18QZ2
Requirements: (See next page for a possible pseudo code)
Develop a program to similar 50,000 searches of customer records by 5 different states. Your team can pick any 5 states to search. Hence, each search consists of searching by 5 different states. In other words, this simulation program will perform 250,000 searches.
Records will be displayed in an ascending order by the zip code. An insertion sort algorithm is used to perform sorting.
Create a comment file to contain the screen shots of your program out and the conclusion your team derive from your program output. Please name the comment file as: TeamNumberQZ2
About Data:
Each line/record in the data file, CustomerAddress.csv, contains 5 fields:
CustomerName, StreetAddress, City, State, ZipCode
The field delimiter is a comma, hence, csv file. Listed below is a sample record:
San Diego State University Foundation,5250 Campanile Drive,San Diego,CA,921822190
Grading Policy
Deducted
Why
5%
Submitted a solution that is identical to the one submitted by others.
5%
Submitted a solution that has nothing or little to do with the requirements.
3%
Submitted an incomplete solution.
2%
Did not submit the comment file or the comment file is incomplete.
1%
Submitted one or more bytecode files.
1%
Submitted one or more files without the names of team members.
1%
Did not follow the file naming instruction.
CMP561 Quiz #2 Page 2
A possible pseudo code for your program:
Begin
Open CustomerAddress.cvs for reading
Loop
Read one data record/line from CustomerAddress.csv
Add the current record to ArrayList
Add the current record to Vector
Add the current to the static array
Until the end of file
Close CustomerAddess.csv
Find out the memory used by ArrayList
Find out the memory used by Vector
Find out the memory used by static array
Loop
Search state #1 against ArrayList
Search state #2 against ArrayList
Search state #3 against ArrayList
Search state #4 against ArrayList
Search state #5 against ArrayList
Until 50,000 times is reached
Find out the CPU time used by searching against ArrayList
Loop
Search state #1 against Vector
Search state #2 against Vector
Search state #3 against Vector
Search state #4 against Vector
Search state #5 against Vector
Until 50,000 times is reached
Find out the CPU time used by searching against Vector
Loop
Search state #1 against static array
Search state #2 against static array
Search state #3 against static array
Search state #4 against static array
Search state #5 against static array
Until 50,000 times is reached
Find out the CPU time used by searching against static array
End of Program
To get answer chat with online assignment adviser
Ask Your Java Programming Assignment Question?
Check out our Help with Java Assignment Service
Find Your ASP.Net Assignment Help by Programming Experts