Given a linked list, print reverse of it using a recursive function. For example, if the given linked list is 1->2->3->4, then output should be 4->3->2->1.
Note that the question is only about printing the reverse. To reverse the list itself see this
Difficulty Level: Rookie
printReverse(head) 1. call print reverse for hed->next 2. print head->data
4 3 2 1
Time Complexity: O(n)
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Print Reverse a linked list using Stack
- An interesting method to print reverse of a linked list
- Print Doubly Linked list in Reverse Order
- Print reverse of a Linked List without extra space and modifications
- Print the last k nodes of the linked list in reverse order | Iterative Approaches
- Print the last k nodes of the linked list in reverse order | Recursive approach
- Recursively Reversing a linked list (A simple implementation)
- Reverse a linked list
- Can we reverse a linked list in less than O(n)?
- Reverse a sublist of linked list
- Reverse a circular linked list
- Reverse even elements in a Linked List
- Reverse first K elements of given linked list
- Reverse a Doubly Linked List | Set-2
- Reverse a Doubly Linked List
- Reverse a Linked List according to its Size
- Reverse a Linked List in groups of given size | Set 1
- Reverse a Linked List in groups of given size | Set 2
- Program to reverse a linked list using Stack
- Reverse a doubly circular linked list