Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE 2017 MOCK II | Question 14

  • Last Updated : 28 Jun, 2021
Geek Week

A balanced tree is given below. How many nodes will become unbalanced when a node is inserted as a child of node G?

tree

Note: A node in a tree is balanced if absolute difference between its left and right subtrees is less than or equal to 1.

(A) 2
(B) 3
(C) 4
(D) 5


Answer: (B)

Explanation: Let node x is inserted.

tree



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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :