Is this Binary Tree Balanced?

37 Views Asked by At

I am doing a HW where part ask to build a binary search tree that is unbalanced and part b says if its not balanced then balance it to a AVL tree.

I built the tree with the given array 11, 40, 20, 13, 21, 50, 60, 9, 2, 10

picture of tree

Part b is where it asks if its unbalanced balance the existing tree that is created in part a. This would indicate that its not balanced but I don't understand why its not already balanced? Is there something obvious I am missing?

1

There are 1 best solutions below

0
On BEST ANSWER

Well an AVL-tree is defined as the left (left half) and the right (right half) subtree not having a height difference of more than $1$, so your tree is indeed balanced yes.

The question, if I read it correctly, asks that IF the tree is unbalanced, then balance it. But it isn't unbalanced so you don't have to do anything.