中序遍歷非遞歸算法
#define maxsize 100
typedef struct
{
Bitree Elem[maxsize];
int top;
}SqStack;
void InOrderUnrec(Bitree t)
{
SqStack s;
StackInit(s);
p=t;
while (p!=null || !StackEmpty(s))
{
while (p!=null) //遍歷左子樹
{
push(s,p);
p=p->lchild;
}//endwhile
if (!StackEmpty(s))
{
p=pop(s);
visite(p->data); //訪問根結(jié)點(diǎn)
p=p->rchild; //通過下一次循環(huán)實(shí)現(xiàn)右子樹遍歷
}//endif
}//endwhile
}//InOrderUnrec