First page Back Continue Last page Graphics
JAVA doesn't tolerate null “this” references very well and we have to examine the height of possibly empty subtrees regularly.
method parameters can be null however so it helps to create a private method that can be passed a (possibly null) node reference and determines the appropriate height.
Its not the best Object Oriented design but it is too convenient to ignore.
private int determineHeight(AVLNode n)
{
if (n == null)
return 0;
else
return n.height;
}