Question: SingleLinkedLists C++ Hello everyone, I need help implementing these functions please. The Main has already been filled out and I am just struggling to complete

SingleLinkedLists C++ Hello everyone, I need help implementing these functions please. The Main has already been filled out and I am just struggling to complete these functions. The comments in each function specify exactly how the function should work. Please use the "iostream library" and don't add any more libraries. Thank you. SingleLinkedLists C++ Hello everyone, I need help implementing these functions please. The

Main has already been filled out and I am just struggling to

complete these functions. The comments in each function specify exactly how the

function should work. Please use the "iostream library" and don't add any

more libraries. Thank you. 1 #include using namespace std; * Here is

1 #include using namespace std; * Here is the data structure of the Linked List SinglelinkedListNode 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 struct SLLNode { int data; SLLNode *next = 0; }; SingleLinkedList class definition 18 19 class SingleLinkedList { private: 20 21 22 23 24 SLLNode* head; //Head for the list int _size; //Keeps track current size of the list public: /** * Constructor for the SingleLinkedlist. */ SingleLinkedList(); // Create an empty list with its header pointing to NULL. 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 /** * Destructor for the SingleLinkedlist. */ -SingleLinkedList(); //Delete all the nodes from the linked list. void load (string fileName); // Open the file named 'filename' in read only mode. // Read the data from the file and insert them at the end of the list. //Close the file after all data have been inserted. 43 44 45 46 47 48 49 50 51 52 53 void save (string fileName); // Open the file named 'filename' in write only mode. //Write the data from the linked list into the file on a single line and separated by spaces. 82 83 84 85 86 87 88 89 90 91 const SLLNode* const search(const int data); // Loop through the list and campare the data of each node with parameter 'data' //If a node matches, return it. //Otherwise, return NULL. const int front(); // Return data from the front node of the list, if the list is not empty. // Return -1, if the list is empty. 92 93 94 95 96 const int back(); // Return data from the last node of the list, if the list is not empty. //Return -1, if the list is empty. void popFront (); //Remove a node fromt the beginning of the list and release memory from the removed node. 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 void popBack(); //Remove a node from the end of the list and release memory from the removed node. void remove (const int data); // Search the list to find a node whose data is equal to parameter 'data' //Do nothing if no such node is found. //Otherwise, remove the macthed node from the list and release its memory. bool empty(); //Return true, if the list is empty. // Return false, otherwise. int size(); // Return current size of the list. 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 void clear(); //Remove all data from the list and release memory from all nodes. }; int main() { return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!