CS-285 Data Structures & Algorithms

Lab #5

Vectors, Lists, and Sorting

 

 

Date:            Tuesday, October 9, 2001

Due:    Friday, October 19, 2001

 

 

The purpose of this assignment is to use STL containers (vector and list) and a generic algorithm (sort) to test the viability of using the same generic algorithm on multiple container types.  The data to be stored in the container must be of a user defined class type named Card.  The Card abstraction uses a container of cards to represent a deck.  In the sorting process, the suits are to be ordered Diamonds, Hearts, Clubs, and Spades.  Aces are low (so they count as 1) and the face cards have the equivalent numeric values (Jack = 11, Queen = 12, King = 13).  Certain containers also implement a sort member function (i.e. list) so compare the results from the generic sort algorithm to the member sort algorithm for this class.

 

As before, pick a partner to work with in an Extreme Programming team.  Be sure to develop test cases before you write your code.  Then, when the program is written and debugged, run your test cases and report whether they pass or fail (do you get the output you expected when you wrote the test case?).  Make the main function the test “driver”, which runs all your tests and writes output to the console which makes it obvious what features your program can demonstrate.  Also, be sure to record your time spent on the lab.