B. [GESP]L5-202506-Q3236-S
[GESP]L5-202506-Q3236-S
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
下面 C++ 代码实现双向链表。函数 is_empty() 判断链表是否为空,如链表为空返回 true,否则返回 false。横线处不能填写( )。
// 节点结构体
struct Node {
int data;
Node* prev;
Node* next;
};
// 双向链表结构体
struct DoubleLink {
Node* head;
Node* tail;
int size;
DoubleLink() {
head = nullptr;
tail = nullptr;
size = 0;
}
~DoubleLink() {
Node* curr = head;
while (curr) {
Node* next = curr->next;
delete curr;
curr = next;
}
}
// 判断链表是否为空
bool is_empty() const {
_______________________
}
};
{{ select(1) }}
return head == nullptr;return tail == nullptr;return head.data == 0;return size == 0;
GESP 2025.06 C++ 五级 全真模拟赛
- 状态
- 已结束
- 规则
- OI
- 题目
- 27
- 开始于
- 2026-11-20 13:32
- 结束于
- 2026-11-25 13:32
- 持续时间
- 2 小时
- 主持人
- 参赛人数
- 0