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

How do I start a c++ project?

0 Answers  


What is the difference between an external iterator and an internal iterator?

0 Answers  


How much is c++ certification?

0 Answers  


What is a class definition?

0 Answers  


What is lvalue?

0 Answers  






Give example of a pure virtual function in c++?

0 Answers  


Tell me an example where stacks are useful?

0 Answers  


What is meant by entry controlled loop? What all C++ loops are exit controlled?

0 Answers   TCS,


What are the basic data types used in c++?

0 Answers  


Can malloc be used in c++?

0 Answers  


Explain data encapsulation?

0 Answers  


WHO DEVELOPED C++?

6 Answers  


Categories