check if a binary tree is balanced