Thanks to David B. Levine of the Computer Science Department at St. Bonaventure University for this nifty assignment.
The secondary objective of this lab is for you to gain experience writing a concise, but complete analysis of a system.
As you know from class, if you double the size of the data set that you give to a quadratic algorithm, it will do four times the work; by contrast, an O(n log n) algorithm will do a bit more than twice as much; and, a linear algorithm will do only twice as much work. As you also know, the characteristics of the input data set can affect the expected performance of many of our sorting algorithms. Before you begin the lab, you should review the expected performance of the algorithms on various data sets.
The sorting algorithms under study this week include (in alphabetical order): bubbleSort, insertionSort, mergeSort, quickSort, selectionSort, and unknownSort.
Note: Quicksort uses median-of-three partitioning. That is, the pivot will be the median of the first, middle, and last elements of the partition each time.
Begin by playing around with the SortDetective applet. Execute it and play with it a bit. Notice that the button names do not give any indication which sort they will execute.
Devise a plan which will enable you to match the particular algorithms to the button names. Hint: It may make sense to try to divide the sorts into initial groups and then to work on each group separately. Divide and conquer: it works for algorithms and it can work here, too!
Execute your plan, taking careful notes as you go.
There is no coding in this lab. Thus, you should expect that a significant portion of the lab grade for this lab will be determined by the quality of the writing of the report. This includes the completeness of the report, the clarity (and grammar) of the writing, and general presentation.
Some of the sorts are very difficult to distinguish. A carefully outlined experiment may compensate for an error in these cases if the writing makes it clear that your conclusions/guesses are substantiated by the data.
| description | points |
|---|---|
| picking correct sorts | 4 points |
| experiment design | 8 points |
| explanation | 8 points |
Turn in your written report in lecture, at the start of class. This program must be completed individually.