读书人

二叉树求高度的部分老师给的答案没

发布时间: 2012-04-11 17:42:33 作者: rapoo

二叉树求高度的部分,老师给的答案,没看懂,求解答

int hauteur (t_noeud * racine)
{
int h=0,hfils=0,i;
if( racine->nbfils==0) return 0;
for (i = 0; i < racine->nbfils; i++)
{
hfils=hauteur(racine->fils[i]);
if (hfils>h) h=hfils;
}
return h+1;
}

麻烦讲解一下程序怎么走的,怎么return的,谢谢啦

忘了说明noeud了~~
typedef struct noeud {
double value;
int height;
struct noeud struct noeud struct noeud *pere;
int nbfils ;
struct noeud ** fils;
int rang;
} t_noeud;

[解决办法]
if( racine->nbfils==0) return 0;
这儿return的

读书人网 >C语言

热点推荐