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

A33253. 下面的代码片段用于在双向链表中删除一个节点。请在横线处填入( ),使其能正确实现相应功能。void deleteNode(DoublyListNode*& head, int value) { DoublyListNode* current = head; while (current != nullptr && current->val != value) { current = curren…

单选题 困难

题目描述

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


void deleteNode(DoublyListNode*& head, int value) {

DoublyListNode* current = head;

while (current != nullptr && current->val != value) {

current = current->next;

}

if (current != nullptr) {

if (current->prev != nullptr) {

____________________________________ // 在此处填入代码

} else {

head = current->next;

}

if (current->next != nullptr) {

current->next->prev = current->prev;

}

delete current;

}

}

选项(单选)

上一题 下一题