You are viewing a single comment's thread. Return to all comments →
My code in c++:
DoublyLinkedListNode* reverse(DoublyLinkedListNode* llist) { if(llist == NULL) return NULL; else if(llist->next == NULL) return llist; `` DoublyLinkedListNode* re = new DoublyLinkedListNode(llist->data); llist = llist->next; while(llist != NULL){ DoublyLinkedListNode* x = new DoublyLinkedListNode(llist->data); x->next = re; re->prev = x; re = x;
llist = llist->next; } return re;
}
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 →
My code in c++:
}