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



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

Answer / 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

More C++ General Interview Questions

What are the five basic elements of a c++ program?

0 Answers  


What is a node class?

1 Answers  


Why do C++ compilers need name mangling?

3 Answers   Lucent,


What is double in c++?

0 Answers  


What you mean by early binding and late binding? How it is related to dynamic binding?

1 Answers  






Can constructor be private in c++?

0 Answers  


What is a rooted hierarchy?

0 Answers  


Can the creation of operator** is allowed to perform the to-the-power-of operations?

0 Answers  


Can user-defined object be declared as static data member of another class?

0 Answers  


When one must use recursion function? Mention what happens when recursion functions are declared inline?

0 Answers  


Why is it necessary to use a reference in the argument to the copy constructor?

0 Answers  


Eplain extern keyword?

0 Answers  


Categories