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
|
/*+
AVLtree.h header file for generic binairy-tree package
(c) Jeroen Hellingman, 1 dec 1989.
-*/
#ifndef AVLTREE_HEADER_READ
#define AVLTREE_HEADER_READ
/* return values */
#define AVL_OK 0
#define AVL_ERROR 1
#define AVL_NO_MEM 2
#define AVL_DUP 3
#define AVL_NO_DEL 4
/* AVLtree structure */
typedef struct AVLtree AVLtree;
struct AVLtree
{ void *element;
char balance;
AVLtree *left;
AVLtree *right;
};
/* ANSI C prototypes */
int AVLinsert(const void *element,AVLtree **root,int (*cmp)(void*, void*));
int AVLdelete(const void *element,AVLtree **root,int (*cmp)(void*, void*),void (*del)(void*));
void *AVLfind(const void *element,AVLtree *root,int (*cmp)(void*, void*));
/* traversal routines */
void AVLpreorder(AVLtree *root, void (*func)(void*));
void AVLinorder(AVLtree *root,void (*func)(void*));
void AVLpostorder(AVLtree *root,void (*func)(void*));
#endif
/* end of AVLtree.h */
|