Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago