void ABC(BTNode * BT){if BT {ABC (BT->;left);ABC (BT->;right);cout<;<;BT->;data<;<;' ';}}该算法的功能是
举一反三
- voidABC(BTNode*BT){ifBT{ABC(BT->left);ABC(BT->right);cout<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);}
- void PreOrder(BinTree bt)//递归先序遍历算法{ if(bt==NULL) return; //递归出口visit(bt); //访问根结点 InOrder (leftchild(bt)); //中序遍历左子树 InOrder (rightchild(bt)); //中序遍历右子树 }void InOrder(BinTree bt)//递归中序遍历算法{ if(bt==NULL) return; //递归出口 PreOrder (leftchild(bt)); //先序遍历左子树 visit(bt); //访问根结点 PreOrder (rightchild(bt)); //先序遍历右子树 }void main(){ bt = CreateBinTree();//创建一棵二叉树 Preorder(bt); //入口}对下面二叉树执行以上程序,则输出序列是()[img=94x192]1803078d93c9821.png[/img] A: 1,2,3,4,5 B: 1,3,5,4,2 C: 5,4,3,2,1 D: 1,3,4,5,2
- void PreOrder(BinTree bt)//递归先序遍历算法{ if(bt==NULL) return; //递归出口 visit(bt); //访问根结点 InOrder (leftchild(bt)); //中序遍历左子树 InOrder (rightchild(bt)); //中序遍历右子树 }void InOrder(BinTree bt)//递归中序遍历算法{ if(bt==NULL) return; //递归出口 PreOrder (leftchild(bt)); //先序遍历左子树 visit(bt); //访问根结点 PreOrder (rightchild(bt)); //先序遍历右子树 }void main(){ bt = CreateBinTree(); //创建一棵二叉树 Preorder(bt); //入口}对下面二叉树执行以上程序,则输出序列是()[img=94x192]18031cb3c2815d5.png[/img] A: 1,3,5,4,2 B: 1,2,3,4,5 C: 5,4,3,2,1 D: 1,3,4,5,2
- 下面是二叉树的中序遍历算法,对空白处填空()void InOrder_Recursion(BinTree bt) //递归中序遍历{ if( ) return; InOrder_Recursion(bt->leftchild); printf("%c",bt->data); InOrder_Recursion(bt->rightchild);}? 以上答案都不对|bt==NULL|bt!=NULL|bt=NULL