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 is the benefit of c++?
What are the different types of polymorphism?
How to write a program such that it will delete itself after exectution?
What are static variables?
What is a node class in c++?
In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
Can I make ios apps with c++?
What is a constructor and how is it called?
class X { private: int a; protected: X(){cout<<"X constructor was called"<<endl;} ~X(){cout<<"X destructor was called"<<endl} }; Referring to the code above, which one of the following statements regarding "X" is TRUE? a) X is an abstract class. b) Only subclasses of X may create X objects. c) Instances of X cannot be created. d) X objects can only be created using the default copy constructor. e) Only friends can create instances of X objects.
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
Can you please explain the difference between static and dynamic binding of functions?