7. Python program to delete a new node from the end of the doubly linked list.In this program, we will create a doubly linked list and delete a node from the end of the list. If the list is empty, print the message "List is empty". If the list is not empty, the tail's previous node will become the new tail of the list thus, deleting the last node from the list. In the above example, node new was the tail of the list. Make tail's previous node that is, node 4 as the tail of the list. Node 4's next will point to null. ALGORITHM:
a. display() will show all the nodes present in the list.
PROGRAM:Output: Original List: 1 2 3 4 5 Updated List: 1 2 3 4 Updated List: 1 2 3 Updated List: 1 2 Updated List: 1 Updated List: List is empty Next TopicPython 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