You are viewing a single comment's thread. Return to all comments →
DoublyLinkedListNode* reverse(DoublyLinkedListNode* llist) { DoublyLinkedListNode* current = llist; DoublyLinkedListNode* temp = NULL;
while (current != NULL) { temp = current->prev; current->prev = current->next; current->next = temp; current = current->prev; } if (temp != NULL) { llist = temp->prev; } return llist;
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* current = llist; DoublyLinkedListNode* temp = NULL;