0 votes 0 votes what is the maximum difference between height of two nodes of AVL tree a.1 b.2 c.3 d.none DS data-structures avl-tree + – Vasu_gate2017 asked May 14, 2017 • recategorized Jul 6, 2022 by Lakshman Bhaiya Vasu_gate2017 541 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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). pawan kumarln answered May 15, 2017 • edited May 23, 2017 by pawan kumarln pawan kumarln comment Share Follow See all 2 Comments See all 2 2 Comments reply Akriti sood commented May 23, 2017 reply Follow Share will the difference btw height of root and leaf node be 1??dts not right na 0 votes 0 votes pawan kumarln commented May 23, 2017 reply Follow Share now i have correct it 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes AVL tree has a property that height must be either -1,0,+1. So, maximum difference is 1. Angkit answered May 15, 2017 Angkit comment Share Follow See all 0 reply Please log in or register to add a comment.
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'... joshi_nitish answered May 15, 2017 joshi_nitish comment Share Follow See all 0 reply Please log in or register to add a comment.