Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please help me solving this lab Lab 2: LINKED LIST IMPLEMENTATION 1. Given linked_list_01.cpp source file and do the following tasks to the

can you please help me solving this lab
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Lab 2: LINKED LIST IMPLEMENTATION 1. Given "linked_list_01.cpp" source file and do the following tasks to the file. a. Add new statements inside the main function to connect nodes nl, n2, and n3 as shown below. n1 n2 n3 item next prev item next prev item next head 10 20 30 ta2 b. Complete the implementation of listNodeBackward() function to list the nodes backward start from the tail. 2. Given "linked_list_02.cpp" source file. As a guide below is the default linked list structure constructed by the "linked_list_02.cpp" source file. head next Guide Yuki Martin Ra Based on the above information do the following tasks to the linked_list_02.cpp" source file. 2. Inside the main function just after the Noden - head: statement, add new statements to access node "Yuki" and then delete it. Below is the new structure of the linked list after the node "Yuki" is deleted. head next SA Sext ment sext James Guido Larry Martin Rames b. Still inside the main function of "linked_list_02.cpp" source file, find the three statements that have been written as follows: Node James = head; Node* guido = james->next; Node* larry - guido->next; Just after those three statements, do the operation to swap the position of nodes James and Guido. Below is the new structure of the linked list after the swap operation is done. head nate next BA next next next Guido Jumes Larry Martin R // linked list 01.cpp #include #include using namespace std; // Class definitions. class Node public: 1/ Nodes's Constructor Node (int): int item; Node* prev: Node. next; }; 1/ Node class constructor implementation Node : : Node (int i) { itemi; 77 Non-member functions implementation void listNodeForward(Node head) Node. current = head; while (current) { cout item next; > // that will print backward from tail // Task 1-b, complete the implementation listhodeBackward void listNodeBackward (Node tail) { // Task 1-b start after this coment 2 void deleteNodes (Node. head) Node* prov: Node. current head; while (current) { prev = current: current = current->next; cout item #include using namespace std; // Student class definition class Node public: // Modes's Constructor with single argument Node (string): // Mode's member variables for node's item. string name; Node. next; }; 11 Punction implementation 1/ Constructor Node : : Node (string n) { namen 1/ Punctions not related to Node class implementation void listNodes (Node. head) { Mode* current = head while (current) cout name next; 1 cout next; cout name next = NULL; if (head = NULL) head = newlode: } else prevNode->next newlode: } // and it provode = newlode; // end for loop // List all nodes cout next; Node* larry = guido->next; // Task 2-b start after this comment 11 Write codes to swap position of nodes james and guido // List all nodes after swapping "James" and "Guido cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

What is linear transformation? Define with example

Answered: 1 week ago

Question

Management (inaugurated) the recycling policy six months ago.

Answered: 1 week ago