Submit source code and running instructions to EAS[1]. Do it in Java. Do not use javas search methods! Do not use Javas Collections or Subclasses, code your own. Place textual responses for 2, 3 and 4 in block comments in your code.
Grade: 5%
- Quicksort
- Implement a generic Quicksort algorithm that takes an array as input, it should use trivial pivot selection.
- This file should be called QSNormal.java
- This class should have a sort method: void sort(int[] input)
- Implement a Quicksort algorithm that uses a Median of Three pivot selection.
- This file should be called QSMedian.java
- The class should have a sort method: void sort(int[] input)
- Write classes that generate test inputs of size 10, 100, 10000, 1000000.
- One file should be RandomGen.java
- One file should be FixedGen.java
- RandomGen should generate uniformly random integers.
- FixedGen should always generate a fixed input.
- Make a driver that sorts values from your input
- This file should be called QSDriver.java
- This file should output the run-time in either ns or s
- it should accept command-line as follows:
java QSDriver <sort> <gen> <length> <seed>
- <sort> is either QSNormal or QSMedian B. <gen> is either RandomGen or FixedGen
- <length> is the number of ints to be sorted in the input array
- <seed> is an optional argument that lets you repeat the random seed for RandomGen (but is ignored by FixedGen)
1
(e) Record performance times of runs for each input size specified in 1c for Quicksorts implemented in 1a and 1b using RandomGen.
- In clear, natural language, describe the performance differences between the two sorts. Try to correlate this with the underlying mechanism.
- This textual response should be no more than 8 lines / 80 words.
- In clear, natural language, describe a pathological input (one that yields a worst-case) for your trivial Quicksort defined in 1a. The FixedGen.java file should produce this pathological input.
- This textual response should be no more than 8 lines / 80 words.
- In clear, natural language, describe how the pathological case performs given the Median of Three Quicksort. Reference performance tests that you run and your understanding of what makes that input a pathological case. 1a.
- This textual response should be no more than 10 lines / 100 words.
2
[1] https://fis.encs.concordia.ca/eas/
Reviews
There are no reviews yet.