Status InOrderTraverse(BiTree t
//采用二叉樹的二叉鏈表存儲結構
//中序遍歷二叉樹T的非遞歸算法
InitStack(S); Push(s
While(!StackEmpty(s)){
While(GetTop(s
Pop(s
If(!StackEmpty(S)){
Pop(s
Push(S
//if
}//While
return ok;
}//InOrderTraverse
Status InOrder Traverse(BiTree T
InitStack(s); p=t;
While(p||!StackEmpty(s)){
If(p){push(S
Else{
Pop(s
P=p
}//else
}//While
return ok;
}//InorderTravers
返回《數據結構》考研復習精編
[
From:http://tw.wingwit.com/Article/program/sjjg/201311/23655.html