Check if a binary search tree is balanced or not