// File: LinkList.h // Definitions for Linked List ADT // The linked list contains a dummy header node that is initialized to // hold a value that will always come first #ifndef LINK_LIST_H #define LINK_LIST_H #include #include "Student.h" using namespace std; class Node { public: // Constructors // Node not in use. Next will be NULL Node(); // Node gets init value. Next is NULL Node(const Student&); // Put Value into Node Student Info; Node *Next; }; class LinkedList { public: // Constructor...Initialize List to contain one dummy header node. // Pre: Argument MUST be the less than minimum value that will // be encountered LinkedList(); // Destructor...Free Memory Held by List ~LinkedList(); // Pre: Arg is a pointer to type Node. It may be undefined // Post: Private member First is NULL pointer void Init(); // Pre:None // Post: Current points at head of list (not dummy header), unless list Empty // Returns: 0 ==> Empty List 1 ==> Success int StartOfList(); // Pre: Current points to a Node // Post: Current points at Next Node in List, or NULL, if End of List // Returns: Pointer to Info Member of Node or NULL if End of List Student GetListElt(); // Pre: Current points to a Node or NULL // Post: Current points at Next Node in List, or NULL, if End of List // Returns: 0 or 1 ==> Success int NextInList(); // Pre: First is defined. // Post: List has been printed std::ostream &PrintList(std::ostream &); // Pre: Arg contains element of the proper type that is the Info // member of a node. // The > operator has been overloaded for NodeInfoType // Post: First points to non-null list containing at least one node void InsertInOrder(Student&); // Pre: The list of 0 or more nodes // The arg contains a value to be used for comparison // Post:Returns a pointer to the list element containing the desired // value contained in the input arg, or NULL if not found. Student* SearchList(Student); // Pre: First is a pointer to a non-null Linked List that contains the // data value in the arg. // Post:First points to a possibly NULL list that has been reduced // by one node, the first node containing the argument. void DeleteInOrder(Student&); protected: Node *First,*Current; }; #endif