38 38 votes In the balanced binary tree in the below figure, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?$1$$3$$7$$8$ Data Structures gate1996 data-structures binary-tree avl-tree normal + – Kathleen 17.7k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 40 40 votes (B). $a,b,c$ will become unbalanced with Balance factor as $+2,+2,+2$ respectively. Balance factor should be $-1,0,+1$. Balance factor = Height(LST) - Height(RST) Or Balance factor = | Height(LST) - Height(RST) | Gate Keeda answered Oct 10, 2014 • edited Dec 24, 2017 by kenzou Gate Keeda comment Share Follow 0 reply Please log in or register to add a comment.
19 19 votes a,b and c are unbalanced Rishi yadav answered Oct 4, 2017 • edited Dec 3, 2017 by Rishi yadav Rishi yadav comment Share Follow See all 2 Comments 2 2 Comments reply iarnav commented Jan 7, 2018 reply Follow flag @ Rishi yadav what s the height of leaf node you have taken while calculating the B.F.? 0 0 replyShare Rishi yadav commented Jan 7, 2018 reply Follow flag May be this help you if any correction comment here thank u 1 1 replyShare Please log in or register to add a comment.
0 0 votes Answer is b and the resultant tree you get after insersion is the following shashankrustagi answered Dec 9, 2020 shashankrustagi comment Share Follow 0 reply Please log in or register to add a comment.