#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#define OK 1
#define ERROR 0
typedef int Status;
typedef char QElemType;
typedef struct QNode {
//链队列结点的类型定义
int data;
struct QNode *next;
}QNode,*QueuePtr;
typedef struct {
QueuePtr front;
QueuePtr rear;
}LinkQueue;
Status InitQueue(LinkQueue &Q) {
//建一个空队列Q
Q.front=Q.rear=(QueuePtr)malloc(sizeof(QNode));
if (!Q.front) exit(0);
Q.front->next=NULL;
return OK;
} //InitQueue_L
Status EmptyQueue(LinkQueue &Q) {
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载