Department of Computer Science

PAD II

Spring Semester 1998

Dr. Maury Eggen

Homework Laboratory Assignment 7:

The next assignment of the semester is to study sorting. We shall 
implement algorithms for the following sorting methods:

Bubble sort
Insertion sort
Quicksort
Heapsort
Treesort
Mergesort
Shell sort

In each case we are interested in making the sorting algorithm as
efficient as possible. In the case of the treesort, you shall create
a binary search tree and process the tree inorder to produce your 
sorting algorithm. 

For this exercise we are interested in the worst case behavior and 
the average behavior of the algorithm. We shall attempt to gather
data to support the claims made in class. Is quicksort really O(n*ln(n))?
What is the worst case behavior of quicksort? Why does heapsort not have
the problems of quicksort? What can be done to improve the bubble sort?
Does it really help all that much? What is the best general purpose sorting
algorithm? Does the answer depend on the size of the data set to be sorted?

Use Excel (or something similar) to produce a chart of your results. Gather
data concerning times, number of comparisons, etc. and discuss your findings.
Run your sorting algorithms on several randomly generated data sets, as well
as an inorder data set and a reverse order data set. What configuration of
the data seems to provide a worst case behavior for a given algorithm? 

FOR ADDITIONAL DETAILS SEE CLASS NOTES OR CONTACT YOUR INSTRUCTOR.

Program due date: 

TR class: Tuesday, 6 April 1998 9:55 am.

MWF class: Monday, 5 April 1998, 9:30am.