第20820题 单选题
双向链表删除节点功能实现代码填空

下面的代码片段用于在双向链表中删除一个节点。请在横线处填入正确代码,使其能正确实现相应功能。

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 }
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析