Be the first user to complete this post

  • 0
Add to List

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 the next and previous pointer.
  • Do the linear traversal of the linked list and keep swapping the next and previous pointers.
  • In the end, make the last pointer the head of the list.

Code:


Output:

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



Also Read: