Homework 2 - Linked Lists

Due: Wednesday September 26, 2007 at 5pm

This assignment focuses on creating and using a generic LinkedList template class. You will have to define the member functions of a LinkedList. The file hw2_list.cpp contains the "header" information for both the ListNode and LinkedList class.

Update Sep 20: The header file had to be altered. The "delete" keyword is reserved by C++. So the "delete" operation for the linked list has now become the "remove" operation.

ListNode class

You will define the member functions to do the following:

LinkedList class

You will define the member functions to do the following:

Menu Program

The menu program will test your implementation of the linked list. In main, you will define a linked list that stores characters. You will then operate on that list according to the following menu:
      Welcome to the Linked List Menu
  =======================================
  1.  Add a character to the list
  2.  Search for a character in the list
  3.  Delete a character from the list
  4.  Print the list
  5.  Copy the list and print the copy

  0.  Exit
  =======================================
The delete and print options (options 3 and 4) should first check if the list is empty. If the list is empty, it should print that the list is empty.

The copy option should create a copy of an empty list, but will also print that the copied list is empty if the source list is empty.

Submit your completed code as an attachment in an email.