This has already been discussed here, but I have an implementation below (which was never discussed in the thread),
public boolean isBalanced(BSTNode node) {
if(maxHeight() > (int)(Math.log(size())/Math.log(2)) + 1)
return false;
else
return true;
}
where maxHeight() returns the maximum height of the tree. Basically I am checking if maxHeight > log(n), where n is the number of elements in the tree. Is this a correct solution?