写出下面算法的功能。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);}
举一反三
- (1)voidAA(BiTree*T){if(T){printf("%c",T->data);AA(T->lchild);AA(T->rchild);}}Writethefunctionofthealgorithmabove.(5.0分)
- 已知向量=(2,t),=(1,2),若t=t1时,∥;t=t2时,⊥,则( ) A: t1=-4,t2=-1 B: t1=-4,t2=1 C: t1=4,t2=-1 D: t1=4,t2=1
- void ABC(BTNode * BT){if BT {ABC (BT->;left);ABC (BT->;right);cout<;<;BT->;data<;<;' ';}}该算法的功能是
- 1.编写递归算法,将二叉树中所有结点的左、右子树相互交换。 StatusExchangeBiTree(BiTree& T) { BiTree p; if(T){ p=T->lchild; T->lchild=T->rchild; T->rchild=p; ExchangeBiTree(T->lchild); } return OK; }
- 已知向量=(2,t), =(1,2),若t=t1时,∥;t=t2时,⊥,则( )