-
Notifications
You must be signed in to change notification settings - Fork 0
/
cirListDeque.h
executable file
·33 lines (26 loc) · 1.04 KB
/
cirListDeque.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
#ifndef __CIRLISTDEQUE_H
#define __CIRLISTDEQUE_H
#include "type.h"
/* Double Link Struture */
struct DLink {
TYPE value; /* value of the link */
struct DLink * next; /* pointer to the next link */
struct DLink * prev; /* pointer to the previous link */
};
/* Deque Structure based on Circularly-Doubly-Linked List */
struct cirListDeque {
int size; /* number of links in the deque */
struct DLink *last; /* pointer to the last link */
};
typedef struct cirListDeque cirListDeque;
void initCirListDeque(struct cirListDeque *q);
int isEmptyCirListDeque(struct cirListDeque *q);
void addBackCirListDeque(struct cirListDeque *q, TYPE val);
void addFrontCirListDeque(struct cirListDeque *q, TYPE val);
TYPE frontCirListDeque(struct cirListDeque *q);
TYPE backCirListDeque(struct cirListDeque *q);
void removeFrontCirListDeque(struct cirListDeque *q);
void removeBackCirListDeque(struct cirListDeque *q);
void removeAllCirListDeque(struct cirListDeque *q);
void printCirListDeque(struct cirListDeque *q);
#endif