#GESP4271. [GESP]L5-202609-Q4271-S
[GESP]L5-202609-Q4271-S
下面函数使用快慢指针查找单链表的中间结点。横线处应填写( )。
struct Node {
int value;
Node *next;
};
Node *middle(Node *head) {
Node *slow = head;
Node *fast = head;
while (fast != nullptr && fast->next != nullptr) {
slow = slow->next;
______________________
}
return slow;
}
{{ select(1) }}
fast = fast->next;fast = fast->next->next;fast = slow->next;fast = head->next;
相关
在下列比赛中: