0% found this document useful (0 votes)
6 views

COMP20290 - Sorting Assignment

Uploaded by

Conor Sievwright
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

COMP20290 - Sorting Assignment

Uploaded by

Conor Sievwright
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMP20290 - Sorting Assignment

Instructions
This is a GRADED assignment and requires a submission to Brightspace.

Submission Instructions
Your submission to Brightspace should consist of a single file called Sorting.java . There should not
be a package statement at top of the file. We will be using our own version of the SortingTest.java
to test your code. It is your responsibility to ensure that your submission works for the original
SortingTest.java file given to you.

The deadline for this assignment is:

Should you require to submit this assignment late please send an email to the TA
([email protected]) and module coordinator ([email protected]) in due time.

Assignment
Provided in the assignment are two java files, Sorting.java and SortingTest.java . You will have to
set up your project to correctly run the test file. For testing you will need to add JUnit4 to your project.

You do not need to modify the contents of SortingTest.java , you can do so during testing, but
again we will not be using your version of the test file.

The Sorting.java file contains skeleton code for the sorting methods that you will need to
implement. For each sorting algorithm you are expected to provide the theoretical, best, worst and
average time complexity in Big O notation, as well as providing an explanation as to how each of
those time complexities were determined. This information should be provided in the form of a
comment or javadoc on one either the list version or array version of each algorithm.

Please ensure to comment your code when necessary and to format it in accordance to the Java style
guide.

1. Mergesort (40% - 25% Implementation - 15% for complexities


(5% each best, worst and average))
Implement the Mergesort algorithm for both generic lists and generic arrays

Provide the theoretical, best, worst and average time complexity in Big O notation, as well as
providing an explanation as to how each of those time complexities were determined.
2. Quicksort (45% - 25% Implementation - 15% for complexities
(5% each) - 5% Theory questions)
Implement the Quicksort algorithm for both generic lists and generic arrays

Provide the theoretical, best, worst and average time complexity in Big O notation, as well as
providing an explanation as to how each of those time complexities were determined.

Provide four potential decisions/optimizations that can be made to the base Quicksort algorithm.
Explain each one provided.

3. Some Light Theory (15% - 7.5% each)


Describe in detail (statement and explanations) how the following two factors impact the performance
of sorting algorithms in general, but in particular contextualise these factors to provide a comparison
of Mergesort and Quicksort

1. "Sortedness" of the input

2. Size of the input

You might also like