数据结构-队列与双端队列(C描述)
2010-05-06 11:59:03 来源:WEB开发网核心提示:1.使用数组实现队列queue.htypedef int ElementType;#ifndef QUEUE_H_INCLUDED#define QUEUE_H_INCLUDEDstruct QueueRecord;typedef struct QueueRecord *Queue;int IsEmpty(Queue
1.使用数组实现队列
queue.h
typedef int ElementType;
#ifndef QUEUE_H_INCLUDED
#define QUEUE_H_INCLUDED
struct QueueRecord;
typedef struct QueueRecord *Queue;
int IsEmpty(Queue Q);
int IsFull(Queue Q);
Queue CreateQueue(int MaxElements);
void DisposeQueue(Queue Q);
void MakeEmpty(Queue Q);
void Enqueue(ElementType X, Queue Q);
ElementType Front(Queue Q);
void Dequeue(Queue Q);
ElementType FrontAndDequeue(Queue Q);
#endif // QUEUE_H_INCLUDED
fatal.h#ifndef FATAL_H_INCLUDED
#define FATAL_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#define Error(Str) FatalError(Str)
#define FatalError(Str) fprintf(stderr, "%sn", Str), exit(1)
#endif // FATAL_H_INCLUDED
更多精彩
赞助商链接