Question: Instruction :- Write all answers in a .cpp file and upload it using the upload option below this question. Be sure to number your question
Instruction:- Write all answers in a .cpp file and upload it using the upload option below this question. Be sure to number your question properly.
Use the following declaration for a singly linked list:-
struct node {
int data;
node *next;
};
The following diagram shows the structure of the singly linked list:-
A. Write C++ codes to create a linked list that has the data and a Head pointer pointing to the first node as shown in the diagram above. Create the four nodes and a pointer. Link the four nodes as in the diagram. (5 Points)
B. Write a function that will insert a node at the end of the list. Use the function declaration given below. The function takes input a pointer to the list and data. (6 Points)
void InsertNode(node *p, int key)
C. Write a function that will remove the last node from the list. (6 Points)
Use the function declaration below:-
void RemoveLastNode(node *p)
Plz write this in C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
