func(Tree T){
if(T==NULL){
printf("樹空");
return;
}
Stack S;
push(S,T);
while(!IsEmpty(S)){
pop(S,T);
visit(T);
if(T->rchild)
push(S,T->rchild);
if(T->lchild)
push(S,T->lchild);
}
}
您可能感興趣的
- 非遞迴先序遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353186.html
- 非遞迴後序遍歷二叉樹版本二https://www.cnblogs.com/Coeus-P/p/9354754.html
- 遞迴演算法–二叉樹寬度https://www.cnblogs.com/Coeus-P/p/9354671.html
- 遞迴演算法–交換二叉樹左右子樹https://www.cnblogs.com/Coeus-P/p/9353568.html
- 遞迴演算法–二叉樹高度https://www.cnblogs.com/Coeus-P/p/9353528.html
- 遞迴演算法–二叉樹中葉子結點https://www.cnblogs.com/Coeus-P/p/9353505.html
- 遞迴演算法–二叉樹中度為2的結點https://www.cnblogs.com/Coeus-P/p/9353495.html
- 遞迴演算法–二叉樹中度為1的結點https://www.cnblogs.com/Coeus-P/p/9353484.html
- 非遞迴實現斐波那契數列https://www.cnblogs.com/Coeus-P/p/9353452.html
- 非遞迴後序遍歷二叉樹版本一https://www.cnblogs.com/Coeus-P/p/9353360.html
- 層次遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353257.html
- 非遞迴中序遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353227.html
- 非遞迴先序遍歷二叉樹https://www.cnblogs.com/Coeus-P/p/9353186.html