+1 vote
in Data Structures & Algorithms I by (110k points)
What maximum difference in heights between the leafs of a AVL tree is possible?

(a) log(n) where n is the number of nodes

(b) n where n is the number of nodes

(c) 0 or 1

(d) atmost 1

My doubt is from AVL Tree in section Binary Trees of Data Structures & Algorithms I

This question was posed to me in an interview.

1 Answer

+1 vote
by (672k points)
selected by
Best answer
Correct choice is (a) log(n) where n is the number of nodes

To explain: At every level we can form a tree with difference in height between subtrees to be atmost 1 and so there can be log(n) such levels since height of AVL tree is log(n).

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.