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