if there is binary tree which one is the easiest way to
delete all child node?

Answer Posted / q

class BinaryTreeNode
{
BinaryTreeNode *left,*right;
public:

//....

//....
~BinaryTreeNode()
{
if(left) delete left;
if(right) delete right;
}

};

delete root, all child nodes will be deleted recusively...

Is This Answer Correct ?    11 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the various storage classes in C++?

885


What is operator overloading in c++ example?

891


What is a manipulative person?

770


What are put and get pointers?

861


Differences between private, protected and public and give examples.

798


Can a function take variable length arguments, if yes, how?

809


What is conditions when using boolean operators?

866


Discussion on error handling of C++ .

883


What is a float in c++?

776


What are the various operations performed on stack?

846


What is an inline function in c++?

891


Does c++ have arraylist?

777


Can we use struct in c++?

800


What does iomanip mean in c++?

915


What is the basic concept of c++?

774