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
Explain some examples of operator overloading?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
What are the four partitions in which c++ compiler divides the ram?
What are the steps in the development cycle?
What is static class data?
Briefly describe a B+ tree. What is bulk loading in it?
When must you use a pointer rather than a reference?
Can a built-in function be recursive?
What is searching? Explain linear and binary search.
Difference between a homogeneous and a heterogeneous container
Which bit wise operator is suitable for checking whether a particular bit is on or off?
Which should be more useful: the protected and public virtuals?
Explain stack & heap objects?
Should the member functions which are made public in the base class be hidden?
How can an improvement in the quality of software be done by try/catch/throw?