Insertion in doubly linked list at the end
In order to insert a node in doubly linked list at the end, we must make sure whether the list is empty or it contains any element. Use the following steps in order to insert the node in doubly linked list at the end.
the pointer temp point to the last node at the end of this while loop. Now, we just need to make a few pointer adjustments to insert the new node ptr to the list. First, make the next pointer of temp point to the new node being inserted i.e. ptr.
make the previous pointer of the node ptr point to the existing last node of the list i.e. temp.
make the next pointer of the node ptr point to the null as it will be the new last node of the list.
[END OF LOOP]
Enter the item which you want to insert? 12 Node Inserted Press 0 to insert more ? 2