CS286 -- Lab 2: Sorting



->Courses
->CS286
-->Homework
-->Lab 1
->Lab 2
-->Lab 3
-->Lab 4
->Electronic Submission
->Old Exams
->C++ Examples
->MSVC++ Info
->STL Info
->MFC/GUI Info
->Software
->Tentative Schedule
->Support Forum
->Course Policies

[Courses]
[Rich][Home][Rich]
[PHome]

Spring Quarter 2002

Objectives Addressed

  • Be able to use generic algorithms from the STL and implement additional generic algorithms.
  • Be able to apply asymptotic time complexity analysis to choose among competing algorithms.
  • Understand how sorting algorithms such as heapsort and quicksort work.

Purpose

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

Assignment

You should implement two generic sorting algorithms (they should have the same interface as the generic sort algorithm). You should implement InsertionSort and HeapSort. One algorithm should require only bi-directional iterators while the other 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 both 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 5 lab)

Each pair should submit one lab report. The report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:

  • Educational Objective
  • Problem Statement
  • Discussion (comparison between the different sorting algorithms, your experience/impressions of the CSP, how you an your partner worked together, any problems you encountered, etc...)
  • Conclusions (what you learned, suggestions of how the lab could be improved, things you would have done differently, etc.)
  • CSP spreadsheet (Begin with a new spreadsheet. Use your best judgement in establishing an initial baseline based on the PSP data from each of you individually. Be sure to justify your methodology for establishing your baseline.)
  • Documented source code

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. It may be wise to keep a diskette backup as well.

If you have any questions, consult the instructor.

© 2001-2002 Dr. Christopher C. Taylor Office: CC-27C Phone: 277-7339 Last Updated: Wed Apr 3 10:48:42 2002
I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to.