search
Log In
2 votes
203 views
int find(Struct Node *root){

int a = 0, b = 0, c = 0;
if(root == NULL) return 0;
if(root-->left == NULL && root--->right == NULL) return 1;
else
a = find(root--->left);
b = find(root--->right);
c = 1 + max(a,b);
return c;
}

What does the above code find?

a) #levels

b) height of a rooted tree

in DS
recategorized by
203 views
0
levels....

number of levels..
0
level try with single node it will give 1

Please log in or register to answer this question.

Related questions

8 votes
4 answers
3
2.3k views
The number of ways we can insert elements { 1, 2, 3, .... 7 } to make an AVL tree, so that it does not have any rotation are _______ ?
asked Jan 18, 2016 in DS Tushar Shinde 2.3k views
0 votes
1 answer
4
174 views
Consider the below code which run on any tree. In-order traversal Post-order traversal Pre-order traversal None of these
asked Dec 27, 2015 in DS Sandeep Singh 174 views
...