问答题 一棵树以孩子兄弟表示法存储,递归算法numberofleaf计算并返回根为,的树中叶子结点的个数(NULL代表空指针)。 typedef struct node{struct node*firstchild,*nextbrother;);D; int numberofleaf(JD*r) {int hum; if(r=NULL)*num=0; else if(r->firstchild==NULL) num=(1)+numberofleaf(r一>nextbrother); else (2) ; return(num); } 【大连理工大学2003三、1(5分)】
【正确答案】正确答案:(1)1 (2)num==numberofleaf(r->firstchild)+numberofleaf(r>nextbrother)
【答案解析】