Build a List class, using a linked-list implementation. For basic operations it
ID: 3562068 • Letter: B
Question
Build a List class, using a linked-list implementation.
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.