Write code to in the form of function to delete a sub-tree of general tree whose parent node is p
//Delete a sub tree recursively
void delete_node(Node *P){
// Do not do anything if the root is null
if (root == NULL) { return; }
// Deleting a subtrees
delete_node(P->left_node);
delete_node(P->right_node);
// Deletiing the current node
free(P);
P = NULL;
}
Comments
Leave a comment