Linkedlist New
Linkedlist New
Step 2: Traverse to the n-1th position of the linked list and connect the new
node with the n+1th node. Means the new node should also point to the same
node that the n-1th node is pointing to. (newNode->next = temp-
>next where temp is the n-1th node).
Steps to insert node at the middle of
Singly Linked List
Step 3: Now at last connect the n-1th node with the new node i.e. the n-
1th node will now point to new node. (temp->next = newNode where temp is
the n-1th node).
Algorithm to insert node at the middle of Singly linked list