It is working initerative but not in reccursive why ? where m i going wrong
@codingblockscpp hi,ye wala function is working fine:
node *reverseReccursive_by_prateek(node *&head)
{
if(head == NULL or head->next == NULL){ //shortcircuit
//do nothing
return head;
}
node *smallHead = reverseReccursive_by_prateek(head->next);
head->next->next = head;
head->next = NULL;
return smallHead;
}
And this is the correct recursive logic. Do you want explanation?
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.