You are viewing a single comment's thread. Return to all comments →
C solution with recursion:
Node* Reverse(Node *head) { if (head == NULL || head->next == NULL) { return head; } Node* nextNode = head->next; head->next = head->prev; Node* newHead = Reverse(nextNode); nextNode->next = head; return newHead; }
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 →
C solution with recursion: