//先序非递归遍历
void
preorder(bitree *BST)
{
bitree *p,*s[100];
int top=0;
p=BST;
while((p!=NULL)||(top>0))
{
while(p!=NULL)
{
cout<<p->data<<" "<<endl;
s[++top]=p;
// cout<<"the value of top is "<<top<<endl;
p=p->lchild;
}
p=s[top--];
//注意TOP值的变化
// cout<<"*******the value of top is "<<top<<endl;
p=p->rchild;
}
}