Inserting a new node in a linked list data structure

Inserting new node in linked list can do 3 ways.

  1. At start of Linked list
  2. In the middle of Linked list
  3. At the end of Linked list

Before starting you have to must know about Linked list and how to create it.

1.  At Start of Linked list

2.  In the Middle of Linked list

Insert a new node with data at the middle of the list and given a linked list containing n nodes..

So now condition is :

  • If n is even, then insert the new node after the (n/2)th node,
  • else insert the new node after the (n+1)/2th node.

Must read this tutorial to Find Length of a Linked List data for better understanding.

3. Add node in linked list Last


One thought on “Inserting a new node in a linked list data structure

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.