给定二叉树,采用链式结构存储,编写算法void count(BitTree bt),实现功能:统计二叉树中度为1的结点数目。

admin2014-10-20  34

问题 给定二叉树,采用链式结构存储,编写算法void count(BitTree bt),实现功能:统计二叉树中度为1的结点数目。

选项

答案void count(BitTree bt) { int i=0: if(bt==NULL) break; else if(bt一>lchild=0&&bt一>rchild!=0||bt一>Ichild!=0&&bt一> rchild=0) i++: else { i+=count(bt-->lchild): i+=count(bt-->rchild): } printf(“%d”,i): }

解析
转载请注明原文地址:https://kaotiyun.com/show/WwvR777K
0

最新回复(0)