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

A27077. 下面C++代码实现双向链表。函数 is_empty() 判断链表是否为空,如链表为空返回 true ,否则返回false 。横线处不能填写( )。//节点结构体 struct Node { int data; Node* prev; Node* next; }; //双向链表结构体 struct DoubleLink{ Node* head; Node* tail; int size; Doub…

单选题 困难

题目描述

下面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{
        _____________________
    }
};

选项(单选)

上一题 下一题