Question: Complete the code from the constructor part onwards using c++ for the Singly Linked List class file1 (1).txt Edited N 1 N N 4 N

Complete the code from the constructor part onwards using c++ for theComplete the code from the constructor part onwards using c++ for the Singly Linked List class

Singly Linked List class file1 (1).txt Edited N 1 N N 4N 9 45 35 20 11 57 36 28 94 73 5534 #include #include #include #include using namespace std; class Node { private:

file1 (1).txt Edited N 1 N N 4 N 9 45 35 20 11 57 36 28 94 73 55 34 #include #include #include #include using namespace std; class Node { private: int elem; //data element Node* next; //Link (pointer) to the next Node public: Node(int elem): elem(elem), next(NULL) 1 friend class MyLinkedList; }; class MyLinkedList { private: Node* head; // pointer to the head of list public: MyLinkedList (); // empty list constructor -MyLinkedList(); // destructor to clean up all nodes bool empty const; // is list empty? const int& front) const; // get the element/data from the front Node void addFront(const int& elem); // add a new Node at the front of the list void removeFront(); // remove front Node from the list void display() const; void loadData(string); //read a file and load it into the linked list void dumpData(string) const; // write the linked list to a file I/Optional Task void sort(); // sort the elements of the list }; void listCommands { cout : Add to the front of the Linked List" : Load the data from and add it into the Linked List" : Dump the contents of the Linked list to ""; getline(cin,user_input); command = user_input.substr(0,user_input.find("")); parameter = user_input.substr(user_input.find("")+1); if(command=="display") myList.displayO; else if(command=="addFront" or command="add") myList.addFront(stoi parameter)),myList.display(); else if(command--"removeFront" or command--"remove") myList.removeFront(),myList.display(); else if(command=="load") myList.loadData(parameter),myList.display(); else if(command == "dump") myList.dumpData(parameter); else if(command == "sort") myList.sort,myList.displayO; else if(command == "help") listCommands; else if(command == "exit") break; else couthead = NULL; } ====== // destructor to clean up all nodes MyLinkedList::-MyLinkedList { // } // Check if the list is empty or not bool MyLinkedList::empty0 const { // } // return the value/elemnt at the front of the lsit const int& MyLinkedList::front() const { // } Il add a node at the front of list void MyLinkedList::addFront(const int& elem) { // } // remove the first node from the list void MyLinkedList::removeFront) { //=== // display all nodes of the linked list void MyLinkedList::display() const { // } IT I/Load data from a file and add it to the Linked List void MyLinkedList::loadData(string path) { I/ } //Dump/write the contents of the list to a file void MyLinkedList::dumpData(string path) const { // } Il // sort the elments of the list using: Hint use bubble_sort void MyLinkedList::sort) { // } file1 (1).txt Edited N 1 N N 4 N 9 45 35 20 11 57 36 28 94 73 55 34 #include #include #include #include using namespace std; class Node { private: int elem; //data element Node* next; //Link (pointer) to the next Node public: Node(int elem): elem(elem), next(NULL) 1 friend class MyLinkedList; }; class MyLinkedList { private: Node* head; // pointer to the head of list public: MyLinkedList (); // empty list constructor -MyLinkedList(); // destructor to clean up all nodes bool empty const; // is list empty? const int& front) const; // get the element/data from the front Node void addFront(const int& elem); // add a new Node at the front of the list void removeFront(); // remove front Node from the list void display() const; void loadData(string); //read a file and load it into the linked list void dumpData(string) const; // write the linked list to a file I/Optional Task void sort(); // sort the elements of the list }; void listCommands { cout : Add to the front of the Linked List" : Load the data from and add it into the Linked List" : Dump the contents of the Linked list to ""; getline(cin,user_input); command = user_input.substr(0,user_input.find("")); parameter = user_input.substr(user_input.find("")+1); if(command=="display") myList.displayO; else if(command=="addFront" or command="add") myList.addFront(stoi parameter)),myList.display(); else if(command--"removeFront" or command--"remove") myList.removeFront(),myList.display(); else if(command=="load") myList.loadData(parameter),myList.display(); else if(command == "dump") myList.dumpData(parameter); else if(command == "sort") myList.sort,myList.displayO; else if(command == "help") listCommands; else if(command == "exit") break; else couthead = NULL; } ====== // destructor to clean up all nodes MyLinkedList::-MyLinkedList { // } // Check if the list is empty or not bool MyLinkedList::empty0 const { // } // return the value/elemnt at the front of the lsit const int& MyLinkedList::front() const { // } Il add a node at the front of list void MyLinkedList::addFront(const int& elem) { // } // remove the first node from the list void MyLinkedList::removeFront) { //=== // display all nodes of the linked list void MyLinkedList::display() const { // } IT I/Load data from a file and add it to the Linked List void MyLinkedList::loadData(string path) { I/ } //Dump/write the contents of the list to a file void MyLinkedList::dumpData(string path) const { // } Il // sort the elments of the list using: Hint use bubble_sort void MyLinkedList::sort) { // }

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!