GATE | GATE 2017 MOCK II | Question 14
A balanced tree is given below. How many nodes will become unbalanced when a node is inserted as a child of node G?
Note: A node in a tree is balanced if absolute difference between its left and right subtrees is less than or equal to 1.
Explanation: Let node x is inserted.
In this structure, Node (C) (B) and (A) not having difference between left subtree and right subtree -1, 0, 1. Therefore 3 nodes become unbalanced.
Quiz of this Question