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 are static and dynamic type checking?
What are the comments in c++?
What are the advantages of c++? Explain
Why c++ does not have finally?
What is a terminating character in c++?
Explain what are the sizes and ranges of the basic c++ data types?
What do the keywords volatile and mean mutable?
what is VOID?
Why is swift so fast?
Explain the concept of memory leak?
What is class invariant in c++?
Reverse the Linked List. Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL
Write a program using display() function which takes two arguments.
How do you define/declare constants in c++?
What is the disadvantage of using a macro?