Interviewer And Interviewee Guide

Data Structure Linked list Interview Question:

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

Submitted by: Muhammad
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.
Submitted by: Muhammad

Read Online Data Structure Linked list Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.