Homework 5, Evaluating Sorts.

Short Description:

Compare the performance of several different sorts.

This assignment is worth 30 points.

Goals

When you finish this homework, you should have:

Formal Description

Implement a framework for testing a number of sorting algorithms. This framework should:

Once your framework is established, you should test each sorting routine ten times various sizes of input.

Find or implement each of the following sorts

Produce a report which You should use other tools, if necessary in your analysis.

Your final report should contain tables and graphs which demonstrate the relative performance of each of these sorts. Use an average of the ten test runs for each sort as a single data point, and plot input size vs time.

For each sort, look at the different times required to sort each of the different samples of the largest size sorted by that sort. Is there one sort that has very consistent performance time? Another way to think of this is an answer to the question Is there any sort which behaves consistently time wise? Include your discoveries in your final report.

Look at the algorithms. Is there any sort that would be particularly useful for maintaining sorted data when the data is dynamic, IE data is being deleted and inserted. Include a discussion of this in your final report.

If keys are very complex, is there a sort which minimizes comparisons? You could find this by employing a custom comparison function that keeps track of the comparisons done. This could be implemented as a singleton or a global variable. You would reset the value before calling a sort, sort using this comparison function, then read the number of comparisons after the sort is complete. Output this just as you would the time spent in the sort.

If data records are very large, is there a sort which minimizes copies? You could find the number of copies similar to the way you would count sorts with a custom swap function. I would count a swap as three copies, while a simple data assignment of a record as one copy.

You should, to the best of your ability provide recommendations on when each sort might be applicable. This should be based on the items above and anything else you discover.

Discussion

You will probably want to test the $O(n^2)$ sorts differently from the $O(n\log n)$ sorts. The latter will require much more input data.

Required Files

A single word document.

Submission

Submit the assignment to the D2L folder Homework 5 by the due date.