Instructions
Comparison of SORT algorithms
The objective of this Assignment is to compare the performance of some standard SORT algorithms.
You should look at MergeSort, QuickSort, (see attached code) and Selection Sort (from Week 2); you can also look at an additional Sort mechanism that isn’t covered in class or that isn’t covered in the book for extra credit. OR you can find an implmentation of Radix Sort.
You will have to find the right implementation in Java so that you can make your comparisons for the 4th algorithm (if you choose to go for the extra credit).
Things you will be comparing are the raw running time (measured with Java time functionality) and the time complexity (iteration count) in terms of a key operation for the algorithms (ex: as we discussed in class for Selection Sort comparisons are often a good way of measuring the time complexity of sort algorithms), for this purpose you’ll have to use meaningful count variables.
Refer to for time methods.
Use:
or
as you see fit.
Testing:
When comparing algorithms you want to make sure that you use a wide variety of test cases. In your case, you should have at least 4 different example sets on which to run your tests, each test case should have at least 20 numbers.
Report:
If you chose a 4th algorithm for extra credit, discuss which is the 4th algorithm and why you chose that.
You must have MergeSort, QuickSort, and Selection Sort.
Discuss your plan for testing. Explain the 4 test cases that you chose and explain briefly why you chose those test cases. Test cases must have at least 50 integers or more.
Summarize your results for both measured running time and time complexity.
Describe your conclusions including insights, and surprises if any. How does the measured time complexity compare with the expected O cost?
Grading:
1. Test plan and code implementation: 50 points
2. Report and results: 40 points
3. What is the sorting mechanism that Arrays.sort() uses? How does that compare with the others? 10 points
4. Extra credit: up to 20 points
MAKE SURE TO USE TEAMS for discussion and to clear doubts.
You can either use the class attached or you can copy and paste into separate classes.
Additional resources for assignment
- ( 5 KB; Mar 23, 2021 9:51 pm )