Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node_id* delete_name(node_id* tree, char name[],int id)
- {
- if (tree == NULL)
- return tree;
- if (strcmp(name, tree->name) > 0)
- tree->left = delete_name(tree->left, name,id);
- else if (strcmp(name, tree->name) < 0)
- tree->right = delete_name(tree->right, name,id);
- else
- {
- if (tree->left == NULL)
- {
- node_id* temp = tree->right;
- free(tree);
- return temp;
- }
- else if (tree->right == NULL )
- {
- node_id* temp = tree->left;
- free(tree);
- return temp;
- }
- node_id* temp = min_value_node_id(tree->right);
- strcpy(tree->name, temp->name);
- tree->id = temp->id;
- tree->right = delete_name(tree->right, temp->name,id);
- }
- return tree;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement