测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A66897. 下⾯的代码⽚段⽤于在双向链表中删除⼀个节点 。请在横线处填⼊( ) ,使其能正确实现相应功能。1 void deleteNode(DoublyListNode*& head, int value) {

单选题

题目描述

下⾯的代码⽚段⽤于在双向链表中删除⼀个节点 。请在横线处填⼊(  )  ,使其能正确实现相应功能。

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 }

选项(单选)