参考答案一:
typedef struct node
{int data;
struct node%Lchild.Rchild;
}NODE;
void leaf(NODEroot)
{if(root!=NULL)
{if((root->Lehild!=NULL&&root->Rchild==NULL)!!
(root->Lehild==.NULL&&root->Rchild I=NULL))
n=n+1: leaf(root->Lchild);
leaf(root->Rehild);
}
}
参考答案二:struct node
{int data;
struct nodeLchild.Rchild;};
void leaf(struct noderoot)
{if(root!=NULL)
{if((root->LchildI=NULL&&root->Rchild==NULL)!!
(root->Lchild= =NULL&&root->Rchild!=NULL))
n=n+1:
leaf(root->Lchild);
leaf(root->Rchild);}
}
【评分参考】结构定义正确2分,函数定义正确2分,条件正确3分,递归正确2分。