Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [SortedLinkedList.h]
- * The SortedLinkedList class declaration/specification.
- */
- #ifndef SORTEDLINKEDLIST_H
- #define SORTEDLINKEDLIST_H
- #include <iostream>
- /**
- * THE Sorted Linked List NODE STRUCTURE:
- */
- struct Node
- {
- float element; // representing each element in the sorted linked list
- Node *next; // the node connecting each element in the sorted linked list
- };
- /**
- * THE Sorted Linked List CLASS SPECIFICATION:
- */
- class SortedLinkedList
- {
- /**
- * Everything under public can be accessed by all other programs or classes.
- */
- public:
- /**
- * Constructor(s):
- */
- SortedLinkedList(); // the sorted linked list's default constructor
- /**
- * Mutators:
- */
- void InsertItem(float); // inserts an item into the list
- void DeleteItem(float); // deletes an item from the list
- /**
- * Accessors:
- */
- float GetNextItem(void); // returns the next item in the list
- /**
- * General Use:
- */
- bool IsEmpty(void); // returns true if the list is empty
- bool IsFull(void); // returns true if the list is full
- void ResetList(void); // resets the list (brings the current position back the the beginning)
- void MakeEmpty(void);
- int LengthIs(void); // returns the length of the list
- bool IsInTheList(float); // returns true if the provided item is in the list
- void Print(void);
- /**
- * Everything under protected can be accessed only by the class itself or (derived) subclasses,
- * as in the case of inheritance.
- */
- protected:
- /**
- * (Private) DATA MEMBERS/PROPERTIES:
- *
- * Everything under private can only be accessed by the class itself (the code in the
- * implementation file).
- */
- private:
- Node *data; // a pointer to the beginning of the list (that can be used to access the next items)
- int length; // the length of the list
- Node *currentPos; // the current position of the list
- };
- #endif // SORTEDLINKEDLIST_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement