TopicWise/Linked List/ReverseLinkedListRecursive.cpp
// Should reverse list and return new head.
Should reverse list and return new head.
Should reverse list and return new head .
void reverselist(Node **head, Node *cur, Node *prev)
{
    if(cur == NULL)
    return;
    if(cur->next == NULL)
    {
        *head = cur;
        cur->next = prev;
        return;
    }
    reverselist(&(*head),cur->next,cur);
    cur->next = prev;
}
void reverselist ( Node * * head , Node * cur , Node * prev ) { if ( cur == NULL ) return ; if ( cur -> next == NULL ) { * head = cur ; cur -> next = prev ; return ; } reverselist ( & ( * head ) , cur -> next , cur ) ; cur -> next = prev ; }
Should reverse list and return new head.
Should reverse list and return new head .