In the tree:
A
/ \
B C <-- Difference = 2
/ /
D E
/
G
What are the two subtrees for node C that make it unbalanced??
In the tree:
A
/ \
B C <-- Difference = 2
/ /
D E
/
G
What are the two subtrees for node C that make it unbalanced??
Let's solve some homework Leslie...
The C tree has two subtrees. One of them isn't pictured...
C
/ \
E
/
G
Calculate the height of each subtree. Height 2 vs Height 0...
Assuming your tree is a binary tree, each node in such tree has at max 2 nodes. While representing a tree if a child node is not explicitly drawn or mentioned, it is assumed to be null
.
Thus the node C
in your case has only one child node i.e. E
and the other child is null.