Java program to delete a new node from the beginning of the doubly linked listIn this program, we will create a doubly linked list and delete a node from the beginning of the list. If the list is empty, print the message "List is empty". If the list is not empty, we will make the head to point to next node in the list then; we will delete the first node. Consider the above example, new was the head of the list. Make head to point to next node in the list. Now, node 1 will become the new head of the list thus, deleting node new. Algorithm
a. display() will show all the nodes present in the list.
Program:Output: Original List: 1 2 3 4 5 Updated List: 2 3 4 5 Updated List: 3 4 5 Updated List: 4 5 Updated List: 5 Updated List: List is empty Next TopicJava Programs |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India