Data Structure Linked list Question:
Download Questions PDF

Explain Java code for recursive solution's base case?

Answer:

/* if we are at the TAIL node:
*/
if(currentNode.next == NULL)
{
//set HEAD to TAIL since we are reversing list
head = currentNode;
return; //since this is the base case
}

Download Linked list Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me what should be done in the base case for this recursive problem?Explain reverse a linked list recursive Java solution?