-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.h
29 lines (24 loc) · 801 Bytes
/
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
#define TRUE 1
#define FALSE 0
typedef int elem;//typos dedomenon
struct node{
elem data;//dedomena
struct node *right;//deksi paidi
struct node *left;//aristero paidi
};
typedef struct node TREE_NODE;//deixnei ton deikti
typedef struct node *TREE_PTR;//synonimo tou deikti komvou
void TR_init(TREE_PTR *root);
int TR_empty(TREE_PTR root);
elem TR_data(TREE_PTR p);
int TR_insert_root(TREE_PTR *root,elem x);
int TR_insert_right(TREE_PTR node,elem x);
int TR_insert_left(TREE_PTR node,elem x);
int TR_delete_root(TREE_PTR *root,elem *x);
int TR_delete_right(TREE_PTR parent,elem *x);
int TR_delete_left(TREE_PTR parent,elem *x);
void TR_preorder(TREE_PTR v);
void TR_inorder(TREE_PTR v);
void TR_postorder(TREE_PTR v);
void TR_print_node(TREE_PTR v);
int TR_search_BST(TREE_PTR root,elem x);