• + 0 comments
    SinglyLinkedListNode* reverse(SinglyLinkedListNode* llist) {
        //if(llist==NULL)
        
        SinglyLinkedListNode* temp=llist,*curr=llist->next,*prev=NULL;
        while(temp->next!=NULL){
        temp->next=prev;
            prev=temp;
            temp=curr;
            curr=curr->next;
        }
        temp->next=prev;
        llist=temp;
        return llist;           
    }