填空题
写出下面算法的功能。voidfunction(Bitree*t){if(p!=NULL){function(p->lchild);function(p->rchild);printf(“%d”,p->data);}}
【参考答案】
二叉树后序遍历递归算法
点击查看答案
相关考题
-
填空题
写出下面算法的功能。Bitree*function(Bitree*bt){Bitree*t,*t1,*t2;if(bt==NULL)t=NULL;else{t=(Bitree*)malloc(sizeof(Bitree));t->data=bt->data;t1=function(bt->left);t2=function(bt->right);t->left=t2;t->right=t1;}return(t);} -
填空题
函数depth实现返回二叉树的高度,请在空格处将算法补充完整。intdepth(Bitree*t){if(t==NULL)return0;else{hl=depth(t->lchild);hr=());if(())returnhl+1;elsereturnhr+1;}} -
填空题
树内各结点度的()称为树的度。
