//中序遍历
void InorderTraversal( BinTree BT )
{
if(BT)
{
InorderTraversal(BT->Left);
printf(" %c",BT->Data);
InorderTraversal(BT->Right);
}
}
//先序遍历
void PreorderTraversal( BinTree BT )
{
if(BT)
{
printf(" %c",BT->Data);
PreorderTraversal(BT->Left);
PreorderTraversal(BT->Right);
}
}
//后序遍历
void PostorderTraversal( BinTree BT )
{
if(BT)
{
PostorderTraversal(BT->Left);
PostorderTraversal(BT->Right);
printf(" %c",BT->Data);
}
}
//顺序存储的层次遍历
void LevelorderTraversal( BinTree BT )
{
if(BT)
{
int i=0,j=0;
BinTree p[100];
i=j=0;
p[i++]=BT;
while(j<i)
{
printf(" %c",p[j]->Data);
if(p[j]->Left)
p[i++]=p[j]->Left;
if(p[j]->Right)
p[i++]=p[j]->Right;
j++;
}
}
}