29 votes 29 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$ DS gate1996 data-structures binary-tree normal + – Kathleen asked Oct 9, 2014 • edited Jun 17, 2019 by Lakshman Bhaiya Kathleen 12.3k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 33 votes 33 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 See all 0 reply Please log in or register to add a comment.
13 votes 13 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 See all 2 2 Comments reply iarnav commented Jan 7, 2018 reply Follow Share @ Rishi yadav what s the height of leaf node you have taken while calculating the B.F.? 0 votes 0 votes Rishi yadav commented Jan 7, 2018 reply Follow Share May be this help you if any correction comment here thank u 1 votes 1 votes Please log in or register to add a comment.
0 votes 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 See all 0 reply Please log in or register to add a comment.