Question: 22) The class below defines a node for a linked list. Write a FUNCTION called INSERT that inserts a node at the end. Assume that

 22) The class below defines a node for a linked list.

22) The class below defines a node for a linked list. Write a FUNCTION called INSERT that inserts a node at the end. Assume that one node named HEAD has already been created. Your function should take any node names as arguments that the user enters in the function call and should assign data. 12 points PLEASE PUT ANSWER HERE class Node string name; int data; Node *next; public: Node() { next = NULL; } void setname(string n) (name n) void setdata(int d) (data d;) void setnext(Node*p) { next . p; } string getname) freturn name: int getdata) (return data;) Node getnext() (return 'next;) 23) FOR THE LINKED LIST BELOw, CHANGE TO MAKE secondPtr the first node and head the second node. Also make it a doubly linked list. have to change links. 10 points Note: you just double value; ListNode "next; ListNode "prev; int main() ListNodehead; head = new ListNode; head->value 12.5; head->next NULL; ListNode *secondPtr new ListNode; secondPtr->value = 13.5; secondPtr->next = NULL; head->next = secondPtr

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!