CS3304 Data and Information Structures

Lab Exercise for Chapter 6 Lists

Build a List class, using a linked-list implementation as described in Section 6.5. For basic operations it should have a default constructor, destructor, and the basic operations: print, insert, and delete. The list should be maintained as an ordered list, i.e., list elements are arranged in ascending order. Give the class a name List. The operations should have the following prototypes:

List(); // Default constructor

~List(); // Destructor

void Print() const; // The function that prints out all list elements, in the order they appear in the list.

void Insert(ElementType); // Insert a new element into the list. The order of elements should be maintained.

void Delete(ElementType); // Delete the first occurrence of the given element, if the element is present in the list;

                                                                // and do nothing, otherwise.

Write a driver program that tests all the functions.

Turn in the tested C++ source files in Blackboard on the due day..