Reverse The Doubly Linked List

Objective: Reverse The Doubly Linked List.

Example:

Reverse The Doubly Linked List

Approach:

  • Every Node in a doubly linked list has next and previous pointer.
  • Do the linear traversal of the linked list and keep swapping the next and previous pointers.
  • At the end, make the last pointer as the head of the list.

Complete Code:


Output:

->4->3->2->1
->1->2->3->4

Leave a Comment

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