填空题
写出下面算法的功能。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;}}
填空题 树内各结点度的()称为树的度。
填空题 在一棵二叉树中,度为0的结点的个数是n0,度为2的结点的个数为n2,则有n0=()。