First of all, I swear this is not homework, it\'s a question I was asked in an interview. I think I made a mess of it (though I did realise the solution requires recursion).
int count() { int retval = 1; if(null != getRightChild()) retval+=getRightChild().count(); if(null != getLeftChild()) retval+=getLeftChild().count(); return retval; }
God I hope I didn't make a mistake.
EDIT: I did actually.