C++ please struct Node { } 1. Define a function called remove. As an input param
ID: 667210 • Letter: C
Question
C++ please
struct Node {
}
1. Define a function called remove. As an input parameter, remove takes a Node pointer to an ordered list. It returns a Node pointer to the Node it is removing (hint: NOT deleting) from the ordered list. After remove has run, the ordered list pointed at by the input parameter no longer contains the Node that is being returned via a Node pointer.
2. Define a function called dequeue. As an input parameter, dequeue takes a Node pointer to a queue. It returns a Node pointer to the Node it is removing (hint: NOT deleting) from the queue. After dequeue has run, the queue pointed at by the input parameter no longer contains the Node that is being returned via a Node pointer.
Explanation / Answer
#include using namespace std; struct node { int data; node *next; }; class Linkedlist_Dequeue { private: int s; node *head,*tail; public : Linkedlist_Dequeue() { s=0; head=NULL; tail=NULL; } void insertAtEnd(int d) { node *p=new node; p->data=d; if(head==NULL) { head=p; //head->next=NULL; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.