Question: circular header linked list Where is the mistake void add(int item) { node*p=new node; p->info=item; node*per=head; for(node*curr=head->next;curr!=head;curr=curr->next){ per=curr; per=per->next; curr->next=p; p->next=per; } { if(head->next==head){ p->next=head;
1- void add (int item); This function inserts a new node after the first node (when the list is empty, the inserted node will be the first node)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
