typedef struct CSNode {
int val;
CSNode *firstchild, *nextsibling;
} CSNode, *CSTree;
int dfs(CSTree *root) {
if (!root) return 0;
else if (!root->firstchild) return 1;
else {
int left = dfs(root->firstchild);
int right = dfs(root->nextsibling);
return left + right;
}
}
二叉树:在孩子兄弟链表表示的树中求叶子节点的个数
猜你喜欢
转载自blog.csdn.net/ASJBFJSB/article/details/103225581
今日推荐
周排行