Ok, I've been trying this over and over and I can't seem to get it right. I have a general tree, and I just need to calculate the height of the tree. This is what I have so far:

All I can say is that the answers I get are close. I know I'm missing something, but I don't know what it is, any ideas?Code://Is a member function of my general tree class int getHeight(gNode *rt) { if (rt == NULL) return 0; //if given node is null, return 0 if (rt->isLeaf()) return 1; //if given node is a leaf, return 1 int height = 0; //height starts at 0 if (rt->getSib() != NULL) //if node has a sibling height = getHeight(rt->getSib()); //set height as height of sibling if (!rt->isLeaf()) //if node is not a leaf height += getHeight(rt->getChild()); //height += height of child return height; }