Answer Posted / r.r.bharti
Simple way:
public int FindDepthOfTree(RBNode n)
{
if (n == null) return 0;
return Math.Max(FindDepthOfTree(n.LeftNode),
FindDepthOfTree(n.RightNode)) + 1;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are different oops concepts?
What are the two different types of polymorphism?
Where You Can Use Interface in your Project
What is object-oriented programming? Webopedia definition
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
What is a null tree?
What is the difference between static polymorphism and dynamic polymorphism?
Why do we use class in oops?
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
What are functions in oop?
Why it is called runtime polymorphism?
How to call a non virtual function in the derived class by using base class pointer
What do you mean by abstraction?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
write a C++ program for booking using constructor and destructor.