PROC print(bt:BiTreexy:integer)
//将二叉树逆时针旋转度打印xy是根结点基准坐标调用时xy=
IF bt<>NIL THEN [ print(bt↑rchildxy+); //中序遍历右子树
writeln(bt>data:xy); //访问根结点
print(bt↑lchildxy+);] //中序遍历左子树
ENDP;
BiTree creat()//生成并中序输出二叉排序树
{scanf(%c&ch) //ch是二叉排序树结点值的类型变量假定是字符变量
BiTree bst=nullf=null;
while(ch!=#) //#是输入结束标记
{s=(BiTree)malloc(sizeof(BiNode)); //申请结点
s>data=ch; s>lchild=s>rchild=null;
if (bst==null) bst=s; //根结点
else //查找插入结点
{p=bst;
while(p)
if (ch>p>data) {f=p; p=p>rchild;} //沿右分枝查f是双亲
else {f=p; p=p>lchild;} //沿左分枝查
if(f>data<ch) f>rchild=s; else f>lchild=s;}//将s结点插入树中
scanf(%c&ch); //读入下一数据
} //while (ch!=#)
return(bst); } //结束 creat
void InOrder(BiTree bst) //bst是二叉排序树中序遍历输出二叉排序树
{if(bst)
{InOrder (bst>lchild); printf(bst>data); InOrder(bst>rchild); }
}//结束InOrder
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []