C implementation of your bonus question, in three lines:
#include <stdio.h> struct node { int data; struct node* next; }; void ReversePrint(struct node* head) { if(head == NULL) return; ReversePrint(head->next); printf("%d ", head->data); } int main() { struct node first; struct node second; struct node third; first.data = 1; second.data = 2; third.data = 3; first.next = &second; second.next = &third; ReversePrint(&first); // Should print: 3 2 1 printf("\n"); return 0; }
Related Posts:
- Exception in thread “main” java.lang.StackOverflowError
- Determining complexity for recursive functions (Big O notation)
- Java recursive Fibonacci sequence
- C++ Algorithmically Simple Recursive Palindrome Checker
- Recursion vs. Iteration (Fibonacci sequence)
- MIPS Recursive Fibonacci Sequence
- For-each over an array in JavaScript
- What is tail recursion?
- Python Linked List
- When to use LinkedList over ArrayList in Java?
- Is there any doubly linked list implementation in Java?
- What is the maximum recursion depth in Python, and how to increase it?
- What is the maximum recursion depth in Python, and how to increase it?
- What is the difference between tree depth and height?
- how to implement quick sort algorithm in C++
- Python: maximum recursion depth exceeded while calling a Python object
- Exception in thread “main” java.lang.StackOverflowError
- How do you reverse a string in-place in JavaScript?
- Python Logic of ListNode in Leetcode
- Print a list in reverse order with range()?
- Python: maximum recursion depth exceeded while calling a Python object
- How to iterate over a JavaScript object?
- How to loop through an array containing objects and access their properties
- Iterate through a HashMap [duplicate]
- How to reverse an std::string? [duplicate]
- Python list sort in descending order
- How to loop through an array containing objects and access their properties
- What is the maximum recursion depth in Python, and how to increase it?
- Java Using Nodes with LinkedList
- Iterate through a HashMap [duplicate]
- Array versus linked-list
- Writing a LinkedList destructor?
- Printing out a linked list using toString
- Creating a copy constructor for a linked list
- double free or corruption (fasttop)
- Reverse Contents in Array
- Why is using “for…in” for array iteration a bad idea?
- Is there a linked list predefined library in Python?
- Recursive print Factorial
- Destructor for a linked List
- Traverse a list in reverse order in Python
- std::out_of_range error?
- Java reverse an int value without using array
- Printing out a linked list using toString
- Python: maximum recursion depth exceeded while calling a Python object
- How do I efficiently iterate over each entry in a Java Map?
- Ocaml Error Unbound Value when using Recursion
- How can I create an array of linked lists in java?
- How can I create an array of linked lists in java?
- What is the easiest/best/most correct way to iterate through the characters of a string in Java?
- Printing an array in C++?
- Easy: Solve T(n)=T(n-1)+n by Iteration Method
- Python Array Rotation
- What is tail call optimization?
- How to loop through an array containing objects and access their properties
- How to iterate over a string in C?
- Debug assertion failed
- What is the perfect counterpart in Python for “while not EOF”
- Assign the negativeCntr with the number of negative values in the linked list
- Bubble Sort Manually a Linked List in Java
- What is a node in Javascript?
- Linked List vs Vector
- python3 TypeError: ‘function’ object is not iterable
- Is log(n!) = Θ(n·log(n))?
- Why does cache locality matter for array performance?
- Recursion in Python? RuntimeError: maximum recursion depth exceeded while calling a Python object
- Reversing a List in Prolog
- member access within null pointer of type ‘struct ListNode’
- C++ Templates – LinkedList
- How can I initialize a LinkedList with entries/values in it?
- Destructor for a doubly-linked list that points to its value
- Understanding Recursion to generate permutations
- creating a reverse method for a python list from scratch
- Iterator for a linkedlist
- How to solve: T(n) = T(n/2) + T(n/4) + T(n/8) + (n)
- Making a deep copy of a LinkedList in java
- “warning: useless storage class specifier in empty declaration” in struct
- How is Python’s List Implemented?
- Implement linked list in php
- When should I use a List vs a LinkedList
- invalid use of template name without an argument list
- Python Quicksort Runtime Error: Maximum Recursion Depth Exceeded in cmp
- Iterative Fibonacci code in Java?
- Multiplication function with recursion in Python
- Array of Linked Lists C++