You are viewing a single comment's thread. Return to all comments →
Iterative method in c:
DoublyLinkedListNode* current =head; DoublyLinkedListNode* temp ;
if(!head){ return head; } while(current->next!=NULL){ temp=current->next; current->next=current->prev; current->prev=temp; current=temp; } current->next =current->prev; current->prev=NULL; head = current; return head;
Reverse a doubly linked list
You are viewing a single comment's thread. Return to all comments →
Iterative method in c:
DoublyLinkedListNode* current =head; DoublyLinkedListNode* temp ;