void Inorder (BTreeNode bt)
{ BTreeNode stack[STACKSIZE],*s;
int top=0;
if(bt==NULL)return; //树空退出
stack[top]=bt;
//根结点入栈
while(top>=0)
//栈非空即未遍历完就继续
{ s=stack[top];
while(s->left!=NULL) //找到最左面的结点,并依次进栈
{ stack[++top]=s->left;
s=s->left;
}
while(top>=0)
{ cout<<s->data<<' ';
//输出该结点
top--;
if(s->right!=NULL)
//如果该结点有右结点,右结点入栈并寻找该结点的最左结点
{ stack[++top]=s->right;
break;
}
s=stack[top]; //否则继续输出栈中结点
}
}
}