You are viewing a single comment's thread. Return to all comments →
DoublyLinkedListNode* reverse(DoublyLinkedListNode* llist) { DoublyLinkedListNode *curr; curr=llist; while(curr->next!=NULL){ curr=curr->next; } DoublyLinkedListNode *head; head=curr; DoublyLinkedListNode *temp; DoublyLinkedListNode *count=NULL; while(curr!=NULL){ temp=curr->prev; curr->next=temp; curr->prev=count; count=curr; curr=temp;
}hhere is three poimter approach
return head; }
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a doubly linked list
You are viewing a single comment's thread. Return to all comments →
DoublyLinkedListNode* reverse(DoublyLinkedListNode* llist) { DoublyLinkedListNode *curr; curr=llist; while(curr->next!=NULL){ curr=curr->next; } DoublyLinkedListNode *head; head=curr; DoublyLinkedListNode *temp; DoublyLinkedListNode *count=NULL; while(curr!=NULL){ temp=curr->prev; curr->next=temp; curr->prev=count; count=curr; curr=temp;
}hhere is three poimter approach
return head; }