CSC 103 Assignment 5:
Sorting




Due Date

10PM THURSDAY 31 May 2001

Part A: A Sort Timing Program

In the sorting implementations in Sort.java, consider the heapsort, mergesort, and quicksort methods. Of these three methods, determine which one runs the slowest on a randomly-ordered 1 Integer-valued array. For that slowest-running algorithm, determine the size of the array that takes two seconds for that algorithm to sort. Call that size S.

Write a testing program in the style of Assignment 4 that times each of the three sorting algorithms on a series randomly-ordered Integer arrays, in 25 even increments from size 1 to S. For each test increment, use the same random array for each of the three sorts.

Plot the timing graphs and reference them in the javadoc comment of the testing program, as was done in Assignment 4.

Part B: Non-recursive Implementation of Mergesort

Implement a non-recursive version of mergesort. Generate timing graphs for it using the same data as in part A. Reference the graph for the recursive and non-recursive version of mergesort in the javadoc comment of your non-recursive program.

Part C: Sorting Time Analysis

Determine the O-notation running time for each of the following sorting algorithms:

for each of the following types of input: That is, you are determining a total of nine running times.

Turnin

Turn in the following files to the assignment named "a5"


Footnotes:

1 You can use the examples/RandomGen program for ideas on how to generate random numbers.