You are viewing a single comment's thread. Return to all 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; }
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a linked list
You are viewing a single comment's thread. Return to all comments →