[MSOE Homepage]

Dr. Taylor's MSOE Homepage

Unix is a Four
Letter Word

My Photo Album

My Personal Homepage

CS-285 Main page

CS-285 -- Lab 2: list Implementation

Winter Quarter 1999-2000



Electrical Engineering and Computer Science Department
Dr. Christopher C. Taylor

CC-27C, 277-7339

www.msoe.edu/~taylor/

Purpose

The purpose of this lab assignment is to develop a greater understanding of the implementation details associated with the STL list class. This is accomplished by implementing a simplified version of the STL list class.

Assignment

This is a two week assignment.

Week One (due 11:00pm, the day prior to week 5 lab)

You are to create a List class that:

  • Makes use of templates so that objects from any class (with a default constructor defined) can be elements of the list.
  • Has two data members that point to the first and last elements in the list (or zero, if the list is empty).
  • Has a default constructor and destructor.
  • And has the following member functions:
    • empty() -- Returns true if list is empty.
    • front() -- Returns first element in list.
    • back() -- Returns last element in list.
    • push_front() -- Adds a new element to the beginning of the list.
    • push_back() -- Adds a new element to the end of the list.
    • pop_front() -- Deletes first element of the list.
    • pop_back() -- Deletes last element of the list.
    • begin() -- Returns an iterator that points to the first element in the list.
    • end() -- Returns an iterator that points to one past the last element in the list.

You may find it useful to create additional classes to aid in the development of your List class. While there is a similar implementation of this class given in our textbook, there are a number of significant errors in its implemenation. I would suggest that you use it only as a guide.

In addition to the above implementation, you should design a test program that tests all of the functionality of the above implementation. The report for the first week need not be self-contained, but it should:

  • contain all of your source code (documented), and
  • contain a discussion of your testing algorithm (explaining how it tests all of the functionality of your List class implementation).

See the submission guidelines below.

Week Two (due 11:00pm, the day prior to week 6 lab)

In week two, you are to continue to build on the List class implementation that you began in week one. In particular, you are required to write copy constructor and assignment operator as well as the following member functions for the List class:

  • insert() -- Adds a new element to the list at a specific location (indicated by an iterator).
  • erase() -- Deletes either a single element (indicated by an iterator) or a range of elements (indicated by two iterators) from the list.
  • remove() -- Delete all occurrences of a given value.

Your testing program should be updated to test the additional functionality of your List class. The lab report for week two 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:

  • Purpose
  • Problem Statement
  • Procedure -- what approach you used to solve the problem
  • Documented source code
  • Discussion (discussion of your testing procedure, test program output, any problems you encountered, etc...)
  • A summary of your activity log indicating how much time you spent on each phase of the assignment. Please report the time in the following categories:
    • Design
    • Coding
    • Debug (before you think it's working)
    • Test (after you think it's working)
    • Documentation
    • Other
  • Conclusions (what you learned, suggestions of how the lab could have been better, things you would have done differently, etc.)

Submission Guidelines

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.


This page was created by Dr. Christopher C. Taylor, copyright 1999.