CompSci 260P Project #1 — Shellsort

Shellsort, the famous, classic sorting algorithm, is really a family of different sorting algorithms, depending on the gap sequence that it uses. For this project, you need to implement five (5) different versions of the Shellsort algorithm. Specifically, you need to implement Shellsort with the following five (5) different gap sequences:
  1. The original Shell sequence, n/2k, for k=1,2,...,log n.
  2. The sequence, 2k-1, for k=log n, ..., 7, 3, 1.
  3. The Pratt sequence, 2p3q, ordered from the largest such number less than n down to 1.
  4. The A036562 sequence, in reverse order, starting from the largest value less than n, down to 1.
  5. A sequence different than any of these, which you invented.

Please test out multiple possibilities for your invented sequence, #5, with the goal of making it the best of the five.

Following up on this, you need to do an experimental time analysis by implementing each of the five above versions of Shellsort, as n grows, with multiple runs for random permutations for each problem size. That is, you need to perform an empirical comparative analysis by running these five implementations on a variety of test cases to experimentally determine the relative efficiencies of these algorithms in the worst and average cases as a function of n.

For each implementation, you need to perform runtime experiments on random permutations, with multiple runs for each problem size, for increasing problem sizes. Specifically, you need to do a set of experiments for each of the following distributions:

You must plot the results on a log-log scale (with uniformly distrubted permuations on one plot and almost-sorted permutations on another) to empirically determine the algorithm's asymptotic running time for each type of distribution. If the data is well-fit with a line, then the slope of the line can be used to determine the exponent in the running time, as explained in this Wikipedia article about log-log plots (focus especially on "Relation with monomials"). You then need to rank all your sorting implementations from asymptotically slowest to fastest based on your experimental results.

Deliverables (to be submitted via EEE dropbox) include the following: