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”?
(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) |
a,b and c are unbalanced
@ Rishi yadav what s the height of leaf node you have taken while calculating the B.F.?
May be this help you if any correction comment here thank u
Answer is b and the resultant tree you get after insersion is the following
64.3k questions
77.9k answers
244k comments
80.0k users