Add method to check whether the tree is balanced