The Gateway to Computer Science Excellence
+1 vote
290 views

Mark the balance factor of each on the tree given on the below figure and state whether it is height-balanced.

in DS by
edited by | 290 views

2 Answers

+2 votes
Balance Factor $=$ height $($left Sub Tree$)−$ height $($right Sub Tree$)$

for height balance tree, balance factor of every node  should be from $ -1  \ to \ 1 \ \  i.e. (-1,0,1)$

So, given tree is height balanced tree.
by
edited by
+1 vote

 

Balancing factor: | height of left subtree - height of right subtree |.

I have marked the balancing factors of all nodes.

Since there is no node that has balancing factor as >=2. Hence, we can say that the tree is balanced.

by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,503 answers
201,890 comments
95,332 users