/* File LinkedList.h contains the declarations and definitions of * LinkedList, a class template for singly linked lists. * * Add descriptions of the basic operations and other required documentation ***************************************************************************/ #ifndef LINKEDLIST #define LINKEDLIST #include using namespace std; class LinkedList { private: class Node { public: //------ DATA MEMBERS OF Node // define data and next members here //------ Node OPERATIONS /* --- The Node class constructor initializes a Node's data members. Precondition: A node has been declared. Receive: dataValue, a DataType value; Postcondition: The data and next members have been set to dataValue and 0, respectively. -------------------------------------------------------------------*/ // define Node constructor here }; //--- end of Node class typedef Node * NodePointer; public: //------ LinkedList OPERATIONS /* --- The LinkedList constructor builds an empty LinkedList object. Precondition: A LinkedList has been declared. Postcondition: Its data members are initialized for an empty list. ---------------------------------------------------------------------*/ // define the class constructor here /* --- The LinkedList copy constructor copies a LinkedList. Precondition: A copy of a LinkedList is needed, Receive: origList, the LinkedList being copied Postcondition: A copy of origList has been constructed. -------------------------------------------------------------*/ /* --- The LinkedList destructor reclaims its storage. Precondition: A LinkedList object's lifetime is over. Postcondition: It's storage has been reclaimed. --------------------------------------------------------------------*/ // declare LinkedList destructor here /* --- Display() prints the contents of the entire linked list to stdout. Receive: A LinkedList (implicitly). Output: The entire LinkedList object to stdout. Return: The LinkedList object (implicitly). ----------------------------------------------------------------------*/ // declare Display() here /* --- Insert() inserts a value into a LinkedList at a given index. Receive: A LinkedList (implicitly); dataVal, a DataType value; index, an unsigned value. Return: The LinkedList object, containing all original values, and dataVal in the position determined by index. ----------------------------------------------------------------------*/ // declare Insert() here private: //------ DATA MEMBERS OF LinkedList // declare ptrFirst as a pointer to a Node and declare numNodes }; //--- end of LinkedList class //---- DEFINITIONS OF MEMBER AND FRIEND FUNCTIONS GO HERE // Define Display() here // Define operator<< here // Define Insert() here // Define the LinkedList destructor here // Define the LinkedList copy constructor here #endif