The Sorting-Comparisons code was written as a response to the following prompt:
There are two parts to this final programming assignment. First, you are to compare the relative performance of different sorting algorithms on the same data set. Second, you are to compare the relative performance of the same algorithm on two different data sets.
These sorting algorithms are to be tested:
(Find the code for these in our book or online.)
SelectionSort BubbleSort InsertionSort MergeSort Quicksort HeapSort Processing Requirements
You must modify each sort to include 2 counters, one to keep track of the number of comparisons and another to keep track of the number of swaps made.
Input
Two files of integers to be sorted. There are a maximum of 100 integers in the first data set and a maximum of 1000 integers in the second data set. It could be easiest to generate these data sets using a random-number generator.
Output
The following output should be repeated for each sort for each file:
The name of the sort An echo print of the input file The sorted file The number of comparisons required (Could be in the same file as the number of swaps) The number of swaps required (Could be in the same file as the number of comparisons)