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
Why do we need pointers?
What is the output of the following program? Why?
Give example of a pure virtual function in c++?
Can a list of string be stored within a two dimensional array?
Is c++ a float?
Who discovered c++?
What is the difference between #import and #include?
Where the memory to the static variables is allocated?
What is friend class in c++ with example?
Why c++ does not have finally?
Why do we use classes in programming?
What is static function? Explain with an example
Why would you use pointers in c++?
What new()is different from malloc()?
What happens when the extern "c" char func (char*,waste) executes?