Question: Programming Project 1 4 . 1 2 . 3 : . Modify the linked list implementation to use a dummy node for the past -
Programming Project :
Modify the linked list implementation to use a dummy node for the pasttheend position whose data member is unused. A pasttheend iterator should point to the dummy node. Remove the container pointer in the iterator class. Reimplement the member functions so that they have the same effect as before.
PLease use C
#include
#include
#include
using namespace std;
class Node
public:
string data;
Node next;
;
void insertNode root string val
Node newNode new Node;
newNodedata val;
ifroot NULL
insert at beginning of list
newNodenext NULL;
root newNode;
else
newNodenext root;
root newNode;
void removeNode root, string val
ifroot NULL
cout"List is empty."data val && curr NULL
first node of linked list has to be deleted
rootcurrnext;
deletecurr;
coutdata val
prev curr;
curr currnext;
ifcurr NULL
coutnext currnext;
cout
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
