Data Structure Linked list Question:
Download Questions PDF

Tell me what should be done in the base case for this recursive problem?


Now, we know what the base case is and how to check for it, but what exactly should we be doing in this case? Well, we obviously want to have a return statement so that we can put a stop to the recursion. But, is there anything else that we should be doing here as well? It turns out that there is something else we need to do in the base case, because in the base case we are at the very end of the linked list. This means that because we are trying to reverse the list, we need to set the head pointer to point to the very last node.

Download Linked list Interview Questions And Answers PDF

Previous QuestionNext Question
Explain reverse a linked list iterative solution in Java?Explain Java code for recursive solution's base case?