CSE 5311 Section 501 Spring 1998
Due: February 16, 1998, in class
1. Implement the HeapSort and QuickSort algorithms from the textbook in the language of your choice (preferably C or Pascal).
2. Implement the Test algorithm. Test(n) creates an array of size n containing random numbers in the range , runs HeapSort and QuickSort on this array, and records the running times. This is repeated, and the results are averaged over three trials. The results are output along with the value of (the average case running time of both sorts). You are to run Test for n = 10, 20, 30, 100, 200, 300, 1000, 2000, 3000, and 10000. Plot the running-time results for HeapSort, QuickSort, and , and estimate the value of the constants in the expression for HeapSort and QuickSort. Be sure to label the axes of your plot and show the proper units.
Once you have successfully compiled and executed your program on a UTA machine, send the code to cs5311-turnin@cse. The source code must be submitted by 5:30 p.m. on the due date. In addition to identifying yourself and the homework number in a comment at the top of your code, also include a ``Compile Using'' comment line so we know how to compile your program. Two examples are
/* Compile Using: gcc file.c -lm */ and (* Compile Using: pc file.p *)
Note on class programs: there will be four programs assigned throughout the semester on the topics of sorting, B trees, minimum spanning trees, and string matching. If you know Java or are interested in learning Java, you may choose to design an interactive animation of one of these algorithms other than the HeapSort/QuickSort program. If you provide a clear and creative Java graphical version of one of the other algorithms, you can submit the code instead of one (and only one) of the assigned programs or to improve your grade for one (and only one) of the assigned programs.