第1个回答 2009-06-21
简单,但是不帮你做作业。 给你写个C的
int countLeafNode (TreeNode* node)
{
if (node->firstChild == NULL) return 1;
else {
TreeNode* curNode = node->firstChild;
int ret = 0;
while (curNode != NULL) {
rer += countLeafNode(curNode);
curNode = curNode->NextSibling;
}
return ret;
}
}本回答被网友采纳