What is the use of smallHead in the code
why we need to return this small head
Recursive Reverse Link List
@vivekpatel hey ,smallhead is the haed of linked list return by recursion ,just simply look like this ,you call recursion to rest of linked list except head ,now assume recursion will bring ans in this case it reverse the small linked list and return its head which we store in smallhead now this is the linked list which is reverse ,now what we have to do just attach head to last of this linked list now we have to return ans which is head of reverse ll which is smallhead,thats why we return it,hope you get it
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.