-
Notifications
You must be signed in to change notification settings - Fork 16
/
rbtree.h
45 lines (37 loc) · 952 Bytes
/
rbtree.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
/*
** rbtree.h for rbtree in /home/chapuis_s/rendu/rbtree
**
** Made by chapui_s
** Login <[email protected]>
**
** Started on Mon Jan 26 19:41:38 2015 chapui_s
** Last update Mon Feb 16 01:01:46 2015 chapui_s
*/
#ifndef RBTREE_H_
# define RBTREE_H_
# include <stddef.h>
# include <stdlib.h>
typedef enum rbcolor
{
BLACK = 0,
RED = 1
} t_rbcolor;
/*-------------------------------------------
** Modify these values according to the tree
**------------------------------------------*/
typedef unsigned int t_key;
typedef unsigned int t_value;
typedef struct s_rbnode
{
t_key key;
t_value value;
t_rbcolor color;
struct s_rbnode *left;
struct s_rbnode *right;
} t_rbnode;
t_rbnode *erase_tree(t_rbnode *node);
t_rbnode *remove_key(t_rbnode *node, t_key key);
unsigned int get_size(t_rbnode *node, t_key key);
t_value get_key(t_rbnode *node, t_key key);
void insert(t_key key, t_value value);
#endif /* !RBTREE_H_ */