implement Mike's solution to determine if a tree is balanced