Checking if binary tree is balanced