- Case StudyHelp.com
- Sample Questions
CMP 561Designand Analysis of Algorithms
CMP 561Designand Analysis of Algorithms Dr. Yao
Homework #4 This is an individual assignment. It is not possible that 2 persons may come up with an identical solution.
Please NEVER submit binary files, including zip files and bytecodes.
Objective: Compare the CPU efficiency between java.util.TreeSet and java.util.HashSet (Operations under comparison are: Search and Update)
In order to test and show the CPU time used by TreeSet and HashSet, you need to create your own scenario along with your own data file and transaction file.
Please name your .java files using your last name as the prefix: YourLastName…. YourLastName….
For example,
YaoTestTreeSet.java
YaoTestHashSet.java
You also need to submit a file in MS Word or pdf format to describe your scenario and your conclusion.
What needs to be submitted?
The .java files
The data file
The transaction file
A comment file in MS Word or pdf format to describe your scenario and conclusion DO NOT submit your output files
Examples of scenario:
1. To update the shipment date for shipped orders.
Order record in the Data file contains: OrderID, OrderDate, ShipmentDate, CustomerID
Each line in the Transaction file contains: OrderID, ShipmentDate
This program
o reads order records from the data file into TreeSet and HashSet data structures
o reads a line from the transaction file
o performs necessary update to the records stored in these data structures
o repeat until all lines in the transaction file has been processed o save the updated records into files:outputTreeSetandoutputHashset
2. To update the status of students.
Student record in the Data file contains: StudentID, LastName, FirstName, Status
Each line in the Transaction file contains: StudentID, status (Accepted, Attending, Withdrew, Graduated)
This program
o reads order records from the data file into TreeSet and HashSet data structures
o reads a line from the transaction file
o performs necessary update to the records stored in these data structures
o repeat until all lines in the transaction file has been processed o save the updated records into output files:outputTreeSetandoutputHashset
CMP561 Homework #4 Page 2
3. To update customer payment information.
Payment record in the Data file contains: CustomerID, Balance, PaidAmount
Each line in the Transaction file contains: CustomerID, Payment (to be added to the PaidAmount)
This program
o reads order records from the data file into TreeSet and HashSet data structures
o reads a line from the transaction file
o performs necessary update to the records stored in these data structures
o repeat until all lines in the transaction file has been processed o save the updated records into output files: outputTreeSetandoutputHashset
Your scenario needs to include both search and update operations. In all of the above scenarios, in order to perform the necessary update, the program needs to find the record by OrderID, StdudentID or CustomerID.
Homework #4 Grading Policy
Deducted
Why
5%
Submitted a solution that is identical or similar 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.
3%
Submitted a file that cannot be compiled.
2%
Submitted a program that generates a run-time error/exception.
2%
Submitted a program that generates an incorrect output.
1%
Submitted one or more binary files, including zip or jar file.
1%
Submitted one or more files without your name.
1%
Did not follow the file naming instruction.
2%
Did not submit the comment file.
1%
Comment file does not explain your scenario.
1%
Comment file does not include your conclusion.
2%
Time used to read data from the data file is included.
To get answer chat with online assignment adviser
Ask Your Java Assignment Help Online?
Check out our Java Programming Assignment Help Service
Find Your computer science assignment topics