added support for binary trees with getLeft() and getRight() methods rather than getChildren()