数据结构:链表队列
发布时间
阅读量:
阅读量
#include<iostream>
#include<algorithm>
using namespace std;
typedef int QElemType;
typedef bool Status;
typedef struct QNode{
QElemType data;
struct QNode *next;
}QNode, *QueuePtr;
typedef struct {
QueuePtr front;
QueuePtr rear;
}LinkQueue;
Status InitQueue(LinkQueue* Q){
Q->rear = Q->front = (QueuePtr)malloc(sizeof(QNode));
if(!Q->front) exit(-1);
Q->front->next = NULL;
return 1;
}
Status DestroyQueue(LinkQueue* Q){
while(Q->front){
Q->rear = Q->front;
全部评论 (0)
还没有任何评论哟~
