You are viewing a single comment's thread. Return to all comments →
Solution in C:
DoublyLinkedListNode* reverse(DoublyLinkedListNode* llist) { struct DoublyLinkedListNode* curr = *(&llist); struct DoublyLinkedListNode* prev = NULL; struct DoublyLinkedListNode* next; while (curr != NULL) { next = curr->next; curr->next = prev; curr->prev = next; prev = curr; curr = next; } *(&llist) = 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 →
Solution in C: