标签:stack pop order top data void ack init tree
void inOrder2(BiTree T){
SqStack s;
init(s);
BiTree p=T;
while(p||s.top!=s.base)
{
if(p)
{
push(s,p);
p=p->lchild;
}else
{
pop(s,p);
printf("%c ",p->data);
p=p->rchild;
}
}
}
void preOrder2(BiTree T)
{
SqStack s;
init(s);
BiTree p=T;
while(p||s.top!=s.base)
{
if(p)
{ printf("%c ",p->data);
push(s,p);
p=p->lchild;
}else
{
pop(s,p);
//printf("%c",p->data);
p=p->rchild;
}
}
}
标签:stack pop order top data void ack init tree
原文地址:http://www.cnblogs.com/bgd150809127/p/6839245.html