Linked Link Insertion at Specified Position

0
1884
Link list

Start: To store address of first node

Temp: Temporarily hold address of node.

Next: Hold address of new node.

Algorithm:

1) Create Link List.

2) Create new node “Next”.

3) Assign value to new node(Next) and NULL to the address of new node(Next).

     Next-> data =Value;

     Next-> Link =NULL;

4) Enter specific position at which you want to insert new node.

5) Repeat step-5 for C=1 to Pos-1;

6) If    

                 Temp->link=NULL, then

                 Print “Invalid Postion”

                 Return

     else

                  Temp=Temp->link;

     end

7) Next-> Link= Temp-> Link;

8) Temp-> Link= Next;

9) Exit

Link list

LEAVE A REPLY

Please enter your comment!
Please enter your name here