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

How much maximum can you allocate in a single call to malloc()?

628


What is an incomplete type in c++?

760


What is c++ w3school?

620


What are manipulators used for?

600


What is pointer in c++ with example?

510






What is the difference between reference and pointer?

607


Difference between declaration and definition of a variable.

581


What is switch case in c++ syntax?

615


what are Operators and explain with an example?

699


What is time_t c++?

599


what are the characteristics of Class Members in C++?

585


Where and why do I have to put the "template" and "typename" keywords?

573


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

825


What is the difference between an array and a list?

579


How do I start a c++ project?

582