Computer Science II (CS 171)
Dr. William J. Joel, WS 110, 7-9353
Project No. 2 (10 points)
(Due Friday, October 4, 2002)

Problem: (a) To modify the source code for Project No. 1 such that it uses the Standard Template Library class vector as oppsed to arrays.
(b) To *count* the number of comparisons made during the sorting process for each vector.
Task:
  • Modify the class BubbleSort from Project No. 1 such that it sorts STL vectors as opposed to standard arrays.
  • Further modify BubbleSort by adding  a counter variable, and appropriate increment steps, in order to count the number of comparisons made to sort each vector. Bubblesort::Sort() should return the number of comparisons for a given sort.
  • Write and execute a C++ program based on your new design that tests your method on four vectors of length 10, 100, 1000, and 10000, respectively.
  • Print a screen capture of the end of each execution, showing a succesful sort, the number of elements sorted, and the comparison count for that sort.
  • Submit copies of your handwritten design (algorithm), printouts of all modified source code files, a printout of  your screen capture, and an executable version of your program on disk.
Notes:
  • Please refer to Project Submission Guidelines for more information on how to submit a project.
  • Feel free to add whatever features you wish to this program. These additions will be critiqued but will have no impact on your project grade whatsoever.
  • Refer to Chapter 1 for more information on the STL class vector.