Question: Write a program to reverse a linked list using recursion. The head of the linked list is passed in the input function and the new


Write a program to reverse a linked list using recursion. The head of the linked list is passed in the input function and the new head must be returned as output. The first line of the input is the number of nodes in the linked list and the second line represents the linked list nodes separated by spaces. The output represents the reversed list We have defined the following node C++ class for you: class Node f public: int value; Node* next NULL; Hi Hint: You are allowed to call helper methods or create your own functions in Stepik. Sample Input 1: 1 2 34 Sample Output 1: 4321 Sample Input 2: Sample Output 2: 2 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
