verify whether a tree is a balanced tree