5 #define MAX_NUMBER_OF_NODES 255 23 new_node->
next = *head;
34 next_node = (*head)->
next;
58 return (head ==
NULL) ? 1 : 0;
93 new_node->
left = *head;
105 next_node = (*head)->
left;
131 if(val < (*tree)->data)
133 insert(&(*tree)->left, val);
135 else if(val > (*tree)->data)
137 insert(&(*tree)->right, val);
152 printf(
"%d\n", current->
data);
174 current = current->
left;
181 printf(
"%d\n", current->
data);
182 current = current->
right;
201 if(!prev || prev->
left == curr || prev->
right == curr)
208 else if(curr->
left == prev)
215 printf(
"%d\n", curr->
data);
234 if(!prev || prev->
left == curr || prev->
right == curr)
241 else if(curr->
left == prev)
258 if(tree ==
NULL || tree->
data == val)
262 return search(tree->
right, val);
264 return search(tree->
left, val);
286 printf(
"Pre Order Display\n");
289 printf(
"In Order Display\n");
292 printf(
"Post Order Display\n");
296 tmp = search(root, 4);
299 printf(
"Searched node=%d\n", tmp->
data);
303 printf(
"Data Not found in tree.\n");
void print_inorder(node_tree *root)
static node_tree * head_tree_free_list
void print_preorder(node_tree *root)
static node_stack StaticPoolStack[MAX_NUMBER_OF_NODES]
void print_postorder(node_tree *root)
_Bool isEmpty(node_stack *head)
void init_tree_free_list()
node_tree * pop_tree_free_list(node_tree **head)
static node_tree StaticPoolTree[MAX_NUMBER_OF_NODES]
void push_tree_free_list(node_tree **head, node_tree *new_node)
node_stack * pop_stack_free_list(node_stack **head)
void insert(node_tree **tree, int val)
void push(node_stack **head, void *t)
void deltree(node_tree *root)
void init_stack_free_list()
#define MAX_NUMBER_OF_NODES
void * top(node_stack *head)
static node_stack * head_stack_free_list
void push_stack_free_list(node_stack **head, node_stack *new_node)
void * pop(node_stack **head)
node_tree * __attribute__((noinline))