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 is overloading in oops?
What is the use of oops?
What are constructors in oop?
What is meant by oops concept?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
What is polymorphism and example?
IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?
How do you explain polymorphism?
What are the components of marker interface?
What is polymorphism give a real life example?
Write a program to sort the number with different sorts in one program ??
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
Can an interface inherit a class?
What are classes oop?
which feature are not hold visual basic of oop?