It doesn’t look possible to reverse a simple singly linked list. A simple singly linked list can only be reversed in O(n) time using recursive and iterative methods.
A memory efficient doubly linked list with head and tail pointers can also be reversed in O(1) time by swapping head and tail pointers.
A doubly linked list with head and tail pointers can also be reversed in O(1) time by swapping head and tail pointers. But we would have to traverse the list in forward direction using prev pointer and reverse direction using next pointer which may not be considered valid.
This article is contributed by Abhishek. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Reverse a linked list
- Reverse first K elements of given linked list
- Reverse a Doubly Linked List | Set-2
- Reverse a sublist of linked list
- Reverse a Linked List according to its Size
- Reverse a circular linked list
- Reverse a Doubly Linked List
- Java Program for Reverse a linked list
- Reverse a Doubly linked list using recursion
- Program to reverse a linked list using Stack
- Reverse a Linked List in groups of given size | Set 2
- Print Reverse a linked list using Stack
- Reverse each word in a linked list node
- Reverse a doubly circular linked list
- Print reverse of a Linked List without actually reversing