Question: (c) Given the following source code: void linkedListType:: insertNode (const int newItem) { nodeType *newNode=new nodeType; newNode->info=newItem; newNode->link=NULL; if (first==NULL) { first newNode; last=newNode;

(c) Given the following source code: void linkedListType:: insertNode (const int newItem)

(c) Given the following source code: void linkedListType:: insertNode (const int newItem) { nodeType *newNode=new nodeType; newNode->info=newItem; newNode->link=NULL; if (first==NULL) { first newNode; last=newNode; //refPoint is a pointer which always point to the first node insert in the list refPoint newNode; } else { newnode->link=first; first newNode; count++; } } Modify the above code, so that if the new item is bigger than the value in the node pointed by the pointer ref Point, add new item at the end of the linked list. Otherwise add new item at the front of the linked list. (30/100)

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 Programming Questions!