You are viewing a single comment's thread. Return to all comments →
Why not simply we can write the below:
//Inserting a Node in-between a List or at the end of of a List nodeToInsert.next = head.next; head.next = nodeToInsert;
return trackedHeadNode;
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
Why not simply we can write the below:
//Inserting a Node in-between a List or at the end of of a List nodeToInsert.next = head.next; head.next = nodeToInsert;