5.设计算法判定给定二叉树是否为二叉排序树。voidBSTree(BiTreet,itflag,itlast);//声明StatusIsBSTree(BiTreet){itflag=1;itlast=0;BSTree(t,flag,last);returflag;}voidBSTree(BiTreet,itflag,itlast)//取地址不需要返回值{if(t-lchildflag)BSTree
5.设计算法判定给定二叉树是否为二叉排序树。voidBSTree(BiTreet,itflag,itlast);//声明StatusIsBSTree(BiTreet){itflag=1;itlast=0;BSTree(t,flag,last);returflag;}voidBSTree(BiTreet,itflag,itlast)//取地址不需要返回值{if(t-lchildflag)BSTree
1.编写递归算法,将二叉树中所有结点的左、右子树相互交换。StatusExchangeBiTree(BiTreeT){BiTreep;if(T){p=T-lchild;T-lchild=T-rchild;T-rchild=p;ExchangeBiTree(T-lchild);}returnOK;}
1.编写递归算法,将二叉树中所有结点的左、右子树相互交换。StatusExchangeBiTree(BiTreeT){BiTreep;if(T){p=T-lchild;T-lchild=T-rchild;T-rchild=p;ExchangeBiTree(T-lchild);}returnOK;}
1