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

Differentiate between the manipulator and setf( ) function?

840


What is a static element?

810


What is the most useful programming language?

822


What do you mean by inheritance in c++?

826


What is std namespace in c++?

916


Write a note about the virtual member function?

809


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

1817


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

836


What is the full form of ios?

762


Explain function overloading

792


Define the process of handling in case of destructor failure?

795


What is the use of "new" operator?

893


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

1047


What do you mean by public protected and private in c++?

802


Write a Program to find the largest of 4 no using macros.

838