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 |
What are the five basic elements of a c++ program?
What is a node class?
Why do C++ compilers need name mangling?
What is double in c++?
What you mean by early binding and late binding? How it is related to dynamic binding?
Can constructor be private in c++?
What is a rooted hierarchy?
Can the creation of operator** is allowed to perform the to-the-power-of operations?
Can user-defined object be declared as static data member of another class?
When one must use recursion function? Mention what happens when recursion functions are declared inline?
Why is it necessary to use a reference in the argument to the copy constructor?
Eplain extern keyword?