-
Notifications
You must be signed in to change notification settings - Fork 0
/
deque.h
46 lines (40 loc) · 1.71 KB
/
deque.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
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* deque.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nkawaguc <nkawaguc@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/13 11:33:02 by nkawaguc #+# #+# */
/* Updated: 2024/10/19 21:34:04 by nkawaguc ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef DEQUE_H
# define DEQUE_H
# include <stdlib.h>
# define DEQUE_DEFAULT_LIMIT 1000
# define DEQUE_EXCEPTION_VALUE -1
typedef struct s_deque
{
int *data;
int limit;
int head;
int tail;
} t_deque;
t_deque *deque_init(void);
void deque_free(t_deque *deque);
int deque_size(t_deque *deque);
int deque_empty(t_deque *deque);
int deque_front(t_deque *deque);
int deque_back(t_deque *deque);
int deque_at_from_front(t_deque *deque, int index);
int deque_at_from_back(t_deque *deque, int index);
void deque_push_front(t_deque *deque, int value);
void deque_push_back(t_deque *deque, int value);
void deque_pop_front(t_deque *deque);
void deque_pop_back(t_deque *deque);
void deque_rotate_front(t_deque *deque);
void deque_rotate_back(t_deque *deque);
void deque_swap_front(t_deque *deque);
int deque_find(t_deque *deque, int target);
#endif