-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathlib_vbtree.h
55 lines (25 loc) · 780 Bytes
/
lib_vbtree.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
50
51
52
53
54
55
#ifndef LIB_VBTREE_H_
#define LIB_VBTREE_H_
#define MAX_HEIGHT 20
typedef struct TreeNode {
void *pData;
struct TreeNode *left;
struct TreeNode *right;
} TreeNode;
typedef struct {
TreeNode *root;
} BinaryTree;
TreeNode newNode(int n);
TreeNode *newTreeNode(void *d);
TreeNode *buildTree(FILE * in);
void vbtree_pre_order(TreeNode *node);
void vbtree_in_order(TreeNode *node);
void vbtree_post_order(TreeNode *node);
TreeNode *vbtree_find_insert(BinaryTree bt, TreeNode d);
int vbtree_node_count(TreeNode *root);
int vbtree_leave_count(TreeNode *root);
int vbtree_height(TreeNode *root);
int vbtree_node_level(int n);
void vbtree_insert_best(TreeNode *lastNode[]);
TreeNode *vbtree_finalize_best(TreeNode *lastNode[]);
#endif /* LIB_VBTREE_H_ */