下⾯的代码⽚段⽤于在双向链表中删除⼀个节点 。请在横线处填⼊( ) ,使其能正确实现相应功能。
1 void deleteNode(DoublyListNode*& head, int value) { 2 DoublyListNode* current = head; 3 while (current != nullptr && current->val != value) { 4 current = current->next; 5 } 6 if (current != nullptr) { 7 if (current->prev != nullptr) { 8 ____________________________________ // 在此处填入代码 9 } else { 10 head = current->next; 11 } 12 if (current->next != nullptr) { 13 current->next->prev = current->prev; 14 } 15 delete current; 16 } 17 }
if (current->next != nullptr) current->next>prev = current->prev;
current->prev->next = current->next;
delete current->next;
current->prev = current->next;