Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void _tree_delete_support(node* x){
- if(x->left_child != NULL){
- _tree_delete_support(x->left_child);
- x->left_child = NULL;
- }
- if(x->right_child != NULL){
- _tree_delete_support(x->right_child);
- x->right_child = NULL;
- }
- x->parent = NULL;
- free(x);
- }
- void tree_delete(tree* tree){
- if(tree->root == NULL){
- printf("Empty Tree\n");
- }else{
- _tree_delete_support(tree->root);
- tree->root = NULL;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement