Question: Data Structures and Objects CS203-lab (output screenshot) Problem - Statement: Complete singly linked list implementation (listADT) by completing following functionalities: 1. InsertToHead - the member

Data Structures and Objects
CS203-lab
(output screenshot)  Data Structures and Objects CS203-lab (output screenshot) Problem - Statement: Complete
singly linked list implementation (listADT) by completing following functionalities: 1. InsertToHead -
the member function inserts a new node with the given value at
the front/head end of the list. Pre-condition - None. Post-condition - The
new node is inserted at the front/head end of the list. 1.
removeFromTail - the member function returns and removes the tail/rear node from

Problem - Statement: Complete singly linked list implementation (listADT) by completing following functionalities: 1. InsertToHead - the member function inserts a new node with the given value at the front/head end of the list. Pre-condition - None. Post-condition - The new node is inserted at the front/head end of the list. 1. removeFromTail - the member function returns and removes the tail/rear node from the existing list. Pre-condition - The list should not be empty. Post-condition - The tailrear node is removed from the list, and the previous node is assigned as the tail. If the pre-condition is not true, the function prints the message "Invalid Condition, and returns -777. Copy the code from next page to your Eclipse / Online compiler and complete the function definitions The file has complete listADT class declarations. Driver code to test your implementations of the listADT member functions is also given in the question. Copy the class declarations and main function from the question paper to your eclipse program . Complete the definitions of two functions mentioned above. . If you correctly implement the two functions mentioned above, the following output should be shown on the screen. Testing the implementation of Singly linked List 20 110 20 Nodes in the list) Remove node from the Tail: 10 30 21e 20 110 Updated Nodes in the list 4 Remove node from the Tail: 120 Remove node from the Tail 2 Updated Nodes in the list - 2 If you correctly implement the two functions mentioned above, the following output should be shown on the screen. *Lemndleu (EXI value: UJ VELLI.EXE 144++ Application C:\USERSLENS VIWUIKSP Testing the implementation of Singly Linked List Data Structure 20 110 10 Nodes in the list - 3 Remove node from the Tail: 10 30 210 20 110 Updated Nodes in the list - 4 Remove node from the Tail: 110 Remove node from the Tail: 20 Updated Nodes in the list - 2 Copy your complete program and output screenshot in the space provided before due date. If you fail to do so, you will not be graded #include using namespace std; class node { public: int info: / The data value to be stored in to the head of the list node* next; node(int e, node* n= NULL) { info: next; } node() next = NULL; 1 }; class listADT private: node head; // Pointer to the head of the list node tail; // Pointer to the tail of the list int count = 0; //Counter to store the number of nodes in the list public: listADTO head = NULL; tail = NULL; } - listADTO:/ the destructor bool isEmptyO://function to check is the list is empty int countNodes(); // tunction to count the number of nodes in the list void printListo: //function to print value stored in the nodes (value of info member) of a list void insertToHead (int); // function to insert a value at the front end of the list int removeFromTailo: 1/ function to remove the head and return its info: bool find(int) const } Definition of the destructor.... listADT::-listADTO for (node *p; tisEmpty(:) { p=head->next; delete head; head =p } || Define the ieEmpty member function from the next line...... bool listADT::IsEmptyo 4 return head == NULL; // Define the countNodes member function from the next line ... int list ADT::countNodes) { return count; > | Define the printList member function from the next line... Dumination // Define the printList member function from the next line... void listADT:printListo) if(count > 0) for (node -tmp = head; tmpl= NULL; tmp = tmp->next) cout Infoinfoc" > cout

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!