void reverse(node* temp)
{
if(temp->next)
{
reverse(temp->next);
temp->next->next = temp;
temp->next = NULL;
}
else
head = temp;
}
Note: It is not actually one pointer as we are using recursion.
{
if(temp->next)
{
reverse(temp->next);
temp->next->next = temp;
temp->next = NULL;
}
else
head = temp;
}
Note: It is not actually one pointer as we are using recursion.
No comments:
Post a Comment