Check if a binary tree is balanced