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 is c strings syntax?

0 Answers  


How do we balance an AVL Tree in C++?

0 Answers   Impetus,


What is the standard template library (stl)?

0 Answers  


What is stack unwinding?

0 Answers  


Why would you use pointers in c++?

0 Answers  






What is namespace & why it is used in c++?

0 Answers  


How many types of comments are there in c++?

0 Answers  


what is static function

2 Answers   Patni,


What are iterators in c++?

0 Answers  


Is c++ the hardest language?

0 Answers  


What is c++ try block?

0 Answers  


What is null pointer and void pointer and what is their use?

0 Answers  


Categories