![](https://cos-cdn.shuashuati.com/pipixue-web/2020-1231-2005-12/ti_inject-812ce.png)
设二以二叉为存储结构,以下是一个对二进行中序遍历的非递归算法。 Status inordertraverse( B iTree t ,Status(*Visit)(TelemType e) ) { // 对以二叉为存储结构的二 t ,采用非递归算法进行中序遍历 InitStack(s); ( 1 ) ; // 根指针进栈 while(!StackEmpty(s)) {while ( ( 2 ) &&p) Push(s,p->lchild); // 向左走到尽头 ( 3 ) ; // 空指针退栈 if ( !StackEmpty(s) ) { Pop(s,p); if(! ( 4 ) ) return error; Push(s,p->rchild); }//if }//while return OK; }//inordertraverse