recategorized by
524 views

3 Answers

Best answer
1 votes
1 votes

hight of left subtree - hight of right subtree <=1

ie. the height difference between its left and right children is at most 1

http://www.cs.cornell.edu/courses/cs312/2007sp/lectures/lec15.html

but here they are asked maximum difference between height of two nodes of AVL tree
 lets take worst case

consider root node and one of the leaf node..

so difference will be O(log n).

edited by
0 votes
0 votes
AVL tree has a property that height must be either -1,0,+1.

So, maximum difference is 1.
0 votes
0 votes
since it is asking for maximum difference in height  of any 2 nodes of AVL...

consider root node and one of the leaf node..

difference will be 'O(log n)'..

if it has been asked about difference in height of left and right subtree then it would be '1'...

Related questions

3 votes
3 votes
1 answer
1