CS385 -- Lab 2: Sorting

Fall 2004
Objectives Addressed
Purpose

This lab assignment is designed to provide insight into the implementation of various sorting algorithms and generic algorithms.

Assignment

You should implement three generic sorting algorithms (they should have the same interface as the generic sort algorithm). You should implement InsertionSort, QuickSort, and a hybrid sort that uses QuickSort on any partition with more than 20 elements and InsertionSort for partitions with 20 or fewer elements. One algorithm should require only bi-directional iterators while the others may require random access iterators.

The sorting algorithms should work on any container (with the appropriate iterators available) containing any type of object for which the less than operator is defined.

In addition, you should write a test program that sorts the words in words.txt. The program should compare all of your sorting algorithms as well as the generic sort algorithm and the list's sort algorithm (be sure to fix it first) by exercising all of them. You may find the benchmark class useful in your comparisons.

Lab report (due 11:00pm, the day prior to week 6 lab)

Each pair should submit one lab report. Your report should include:

Template Lab Report

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic Submission Guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

If you have any questions, consult the instructor.

Last Updated: Thursday, 19-Aug-2004 06:11:53 CDT