Search code examples
treebinary-treetree-balancing

What are the two subtrees for C that makes 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??


Solution

  • 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...