#include <iostream>
using namespace std;
typedef int ELement;
//===========================带头结点的双链表==============================
typedef struct DNode {
ELement date;
struct DNode* prior, * next;
}DNode,*DLinkList;
//初始化
bool DInit(DLinkList& L) {
L = (DNode*)malloc(sizeof(DNode));
if (L == NULL) {
return false;
}
L->next = NULL;
L->prior = NULL;
cout << "初始化成功" << endl;
}
//判空
bool isDEmpty(DLinkList& L) {
if (L->next == NULL) {
cout << "链表为空" << endl;
return true;
}
cout << "链表不为空" << endl;
return false;
}
//判断空间是分配成功
bool allocate2(DNode* p) {
if (p == NULL) {
cout << "空间分配失败"
带头节点的双链表和循环双链表的基本操作
最新推荐文章于 2022-10-23 15:02:20 发布