The balance factor of a node in a binary tree is defined as _____

Category: QuestionsThe balance factor of a node in a binary tree is defined as _____
Editor">Editor Staff asked 4 weeks ago

The balance factor of a node in a binary tree is defined as _____
 
(a) addition of heights of left and right subtrees
 
(b) height of right subtree minus height of left subtree
 
(c) height of left subtree minus height of right subtree
 
(d) height of right subtree minus one
 
Origin of the question is Binary Trees in section Binary Trees of Data Structures & Algorithms I
 
I got this question in homework.

1 Answers
Editor">Editor Staff answered 4 weeks ago

The correct choice is (c) height of left subtree minus height of right subtree
 
Explanation: For a node in a binary tree, the difference between the heights of its left subtree and right subtree is known as balance factor of the node.