Engr. 4892 Assignment 3

Due: 0900 Thursday, June 12, 2003.

Doubly-linked List Methods

In this assignment you are to add the following function templates to the doubly-linked list class template, as implemented in assign3_list.h.

  int find(const T& e); 
  // Pre: none (note you cannot assume that L is sorted).
  // Post: if e is in L then result = the index of the first occurance of e
  //                         and err' = Ok
  //       if e is not in L then err' = NoSuchElement

  Status reverse(); 
  // Pre: none
  // Post: L' is a reversed version of L 
  //      (i.e., if L = { 'A', 'B', 'C' } then L' = { 'C', 'B', 'A' })
  //      Note: this function should NOT use new or delete.

Each of your functions should set the value of the private member err so that getStatus will return the correct value, as follows:

Submit a modified version of assign3_list.h containing your function template declarations and definitions. You may add any private functions or variables that you find helpful, but do not remove or modify any of the existing methods, and do not use any other existing member functions.

Be sure to include appropriate comments, including file and function header blocks (see Assignment Policies), and to use good style as outlined in Programming With Style. Submit your source code using Web Submit.

Back to 4892 homepage

Last modified: Fri 2003.06.06 at 14:32 NDT by Dennis Peters