// linkQueue.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
using namespace std;
typedef int Element;
typedef struct LinkNode {
Element date;
struct LinkNode* next;
}LinkNode;
typedef struct {
LinkNode* front, * rear;
}LinkQueue;
//================================================带头结点=========================================
//初始化
bool init(LinkQueue &Q) {
//申请空间
Q.front = Q.rear = (LinkNode*)malloc(sizeof(LinkNode));
if (Q.front == NULL || Q.rear == NULL) {
cout << "初始化失败" << endl;
}
Q.front->next = NULL;
cout &l
链表实现队列的基本操作
最新推荐文章于 2024-05-05 12:00:00 发布