-
Notifications
You must be signed in to change notification settings - Fork 0
/
tree.h
49 lines (34 loc) · 1.18 KB
/
tree.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
47
48
49
#pragma once
#include "header.h"
#include "sfmem.h"
#include "sfstr.h"
struct _sf_treenode_s
{
void *val;
struct _sf_treenode_s *left;
struct _sf_treenode_s *right;
};
typedef struct _sf_treenode_s tree_t;
typedef void (*__sftreetraversal_ret_routine) (void *);
#ifdef __cplusplus
extern "C"
{
#endif
SF_API tree_t *sf_tree_new (void *_Val, tree_t *_Left, tree_t *_Right);
SF_API void sf_tree_addleft_leaf (tree_t *_Tree, void *_Val);
SF_API void sf_tree_addright_leaf (tree_t *_Tree, void *_Val);
SF_API void sf_tree_traverse_pre (tree_t *_Tree,
__sftreetraversal_ret_routine _Callback);
SF_API void sf_tree_traverse_in (tree_t *_Tree,
__sftreetraversal_ret_routine _Callback);
SF_API void sf_tree_traverse_post (tree_t *_Tree,
__sftreetraversal_ret_routine _Callback);
SF_API void
sf_tree_traverse_levelord (tree_t *_Tree,
__sftreetraversal_ret_routine _Callback);
SF_API int sf_tree_height (tree_t *_Tree);
SF_API int sf_tree_countNodes (tree_t *_Tree);
SF_API void sf_tree_free (tree_t *_Tree);
#ifdef __cplusplus
}
#endif