CPSC 221H: Data Structures & Algorithms
Programming Assignment #4
Spring 2009


General Guidelines for Programs


Assignment

Due: Friday April 10, 2009 by Midnight.
The code and the report should be turned in both electronically (using the mechanism described above) and in hardcopy. The hardcopy report should also include a copy of the code. The hardcopy code and report should be turned in during lab on Tuesday.

The objective of this assignment is to study how the theoretical analysis of a variety of sorting algorithms compares with their actual experimentally measured performance. The sorting algorithms you will study are:

The major emphasis of this assignment will be to analyze the performance of the algorithms (not on coding the algorithms). You will be given C++ templates which implement most of the above algorithms. You will need to make a few modifications to test out different strategies. Most of your time should be spent on designing careful test cases and analyzing your results in order to draw conclusions regarding the performance of the various algorithms and to study how the experimental performance is correllated, or not, with the theoretical performance.

Coding Portion (50 points).

NOTES:

Report (50 points). You will write a brief report that includes theoretical analysis, a description of your experiments, and discussion of your results. Minimum requirements for your report include:

NOTE: One way to estimate asymptotic complexity by your experimental results is to graph the running time with a doubly logarithmic (log-log) plot; that is, to plot log T(n) versus log n. Then use linear regression (the method of least squares) to fit the doubly logarithmic curve with a line and find the slope k and the intercept c of the line. The running time can be approximated by c n^k; thus the estimated asymptotic complexity is O(n^k). Input sizes that are doubled each time are recommended, for example, 100, 200, 400, 800, 1600 and etc. They give equal intervals to every two adjacent points of the plot.

Here is an archive file including all the files for this assignment, including some matlab templates to help you prepare plots: prog4.zip (for UNIX and for MS Windows).