【正确答案】正确答案:void PreOrderUnrec(Bitree*t) { Stack s: StackInit(s); Bitree*p=t; while(p!=NULL||!StackEmpty(s)) { while(p!=NULL)//遍历左子树 { visite(p一>data); push(s,p); p=p一>lchild; } if(!StackEmpty(s))//通过下一次循环中的内嵌while实现右子树遍历 { p=pop(s); p=p一>rchild; }//endit }//endw
【答案解析】