-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollection.h
46 lines (40 loc) · 1.01 KB
/
collection.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
#ifndef COLLECTION_H_
#define COLLECTION_H_
#include <stdio.h>
typedef struct node_t
{
struct node_t* prev;
struct node_t* next;
void* info;
} node_t;
typedef struct queue_t
{
node_t* head;
node_t* tail;
int size;
} queue_t;
typedef struct list_t
{
node_t* head;
node_t* tail;
int size;
} list_t;
void queue_push(queue_t* queue, void* elem);
void* queue_top(queue_t* queue);
int queue_is_empty(queue_t* queue);
char *get_line(FILE *fd);
char *get_delim(FILE *fd, char d);
queue_t* queue_init();
void queue_pop(queue_t* queue);
void queue_delete(queue_t* queue);
int list_is_empty(list_t* l);
void list_insert_tail(list_t* list, void* elem);
void list_insert_head(list_t* list, void* elem);
list_t* list_init();
void list_print(list_t* list);
void* list_head(list_t* list);
void list_delete_head(list_t* list);
void list_delete_tail(list_t* list);
list_t* list_delete(list_t* list, int dealloc);
void list_delete_elem(list_t* list, void* elem);
#endif /* COLLECTION_H_ */