Basic Structure
In this lab you will use a linked list to practice using dynamic memory. However, you will only implement only a small subset of the functions full linked list implementations usually have--enough to implement what is known as a "queue". A queue only supports adding new items to the end of the list (the "tail"), and then extracting items in order from the start of the list (the "head").
Your assignment is to finish implementing three of the member functions of
the class List: AddToEnd(), RemoveFromStart() and Size().
The List class you will be filling out implements a linked list of ints.
It consists of an object of the class List
, which has a
pointer to the first Node. Each Node in turn has a pointer to the next
Node in the list. There is a dummy Node, that is always present as the
first item in the list, i.e., the List object's m_head points to a
dummy Node. This node contains no real data (the m_data field is just set
to 0) and is not actually considered an element. It is there because
it makes the implementation much easier, because you can then count on
even an empty queue having at least that one Node.