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
How much maximum can you allocate in a single call to malloc()?
What is an incomplete type in c++?
What is c++ w3school?
What are manipulators used for?
What is pointer in c++ with example?
What is the difference between reference and pointer?
Difference between declaration and definition of a variable.
What is switch case in c++ syntax?
what are Operators and explain with an example?
What is time_t c++?
what are the characteristics of Class Members in C++?
Where and why do I have to put the "template" and "typename" keywords?
int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}
What is the difference between an array and a list?
How do I start a c++ project?