What is shead use in optimized recursive reverse function?


what is the use of shead in this function ?
it is not getting used in code but only getting repeatedly returned to next function

See what your shead function is doing is it is traveling one step ahead of head node until it reaches last or second last node, and then from there we are getting out of recursion time to time and reversing the linked list.
See this to get an idea for visualization

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.