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
What is a memory leak c++?
What is the use of c++ programming language in real life?
What is a terminating character in c++?
What happens if a pointer is deleted twice?
Describe the setting up of my member functions to avoid overriding by the derived class?
What is a container class?
Do vectors start at 0 c++?
What is cout flush?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
What is the disadvantage of using a macro?
Can a list of string be stored within a two dimensional array?
What is fixed in c++?
What is a down cast?
What are the c++ access specifiers?
How many types of classes are there in c++?