直接上代码,简单明了,直接就可以用。
层序遍历子函数:
void cengxu(struct hh *root)
{
int out=0,in=0;
struct hh *q[100];
q[in++]=root;
while(in>out)
{
if(q[out]!=NULL)
{
printf("%c",q[out]->data);
q[in++]=q[out]->l;
q[in++]=q[out]->r;
}
out++;
}
}