Answer to Question #211314 in C++ for rahul

Question #211314

Write code to in the form of function to delete a sub-tree of general tree whose parent node is p


1
Expert's answer
2021-06-30T03:16:16-0400
void deleteNode(Node *p){ 
 if (root == NULL) { return; }
  deleteNode(p->left_node);
  deleteNode(p->right_node);
  free(p);
  p = NULL;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS