Header File for List ADT - Linked List Implementation
// ********************************************************* // Header file ullist.h for the ADT List. // Pointer-based implementation. // ********************************************************* #ifndef ULLIST_H #define ULLIST_H typedef int listItemType; struct listNode // a node on the list { listItemType Item; // a data item on the list listNode* Next; // pointer to next node }; // end struct typedef listNode* ptrType; // pointer to node class List { public: // constructors and destructor: List(); // default constructor List(List& L); // copy constructor ~List(); // destructor // List operations: int isEmpty(); int length(); int insert(int NewPosition, listItemType NewItem); int del(int Position); int retrieve(int Position, listItemType& DataItem); private: int Size; // number of items in list ptrType Head; // pointer to linked list of items // Returns a pointer to the Position-th node // in the linked list. ptrType PtrTo(int Position); }; // end class // End of header file. #endif
Email Me | Office Hours | My Home Page | Department Home | MCC Home Page