-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqueue.h
40 lines (32 loc) · 767 Bytes
/
queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef __QUEUE__
#define __QUEUE__
#include "type.h"
typedef struct {
ElemType data[MaxSize];
int front, rear;
} SqQueue;
typedef struct QNode {
ElemType data;
struct QNode *next;
} QNode;
typedef struct {
struct QNode *front, *rear;
} LiQueue;
#ifdef LINKED
typedef LiQueue Queue;
#else
typedef SqQueue Queue;
#endif
void InitQueue(SqQueue &S);
void DestoryQueue(SqQueue &S);
bool EnQueue(SqQueue &S, ElemType x);
bool DeQueue(SqQueue &S, ElemType &x);
bool GetHead(SqQueue &S, ElemType &x);
bool QueueEmpty(SqQueue S);
void InitQueue(LiQueue &S);
void DestoryQueue(LiQueue &S);
bool EnQueue(LiQueue &S, ElemType x);
bool DeQueue(LiQueue &S, ElemType &x);
bool GetHead(LiQueue &S, ElemType &x);
bool QueueEmpty(LiQueue S);
#endif