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 the advantages of inheritance in c++?
Can a built-in function be recursive?
Explain the term memory alignment?
What are the data types in c++?
What are advantages of c++?
What is purpose of abstract class?
How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?
What do c++ programmers do?
Describe the role of the c++ in the tradeoff of safety vs. Usability?
Can union be self referenced?
What are the advantages of using const reference arguments in a function?
What are pointers used for c++?
Is c++ pass by reference or value?
Explain stack unwinding.
To what does “event-driven” refer?