博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
二叉树后序遍历<非递归>
阅读量:7236 次
发布时间:2019-06-29

本文共 626 字,大约阅读时间需要 2 分钟。

while(curr) {        //print left most node, notice the root node        if ((curr->left && curr->left->visited == false) || (curr->right && curr->right->visited == false)) {            while (curr->left || curr->right) {                if (curr->left && curr->left->visited == false) {                    curr = curr->left;                    treeStack.push_back(curr);                    continue;                }                curr = curr->right;                treeStack.push_back();            }            continue;        }        printTree(curr);        curr->visited = true;        curr = treeStack.pop_back();    }

转载地址:http://cylfm.baihongyu.com/

你可能感兴趣的文章
Rafy 框架 - 流水号插件
查看>>
探索MVP(Model-View-Presenter)设计模式在SharePoint平台下的实现
查看>>
鼠标移动到图片上切换到另一张图片,移出时又切回来
查看>>
带下拉框的GridView的OnRowEditing
查看>>
构建Spring Boot程序有用的文章
查看>>
【CSS进阶】伪元素的妙用--单标签之美
查看>>
ASP.NET多附件上传和附件编辑的实现
查看>>
增加系统右键菜单
查看>>
Scala中的构造器和高阶函数
查看>>
用RSL来为你的flex程序减肥
查看>>
为 Azure IoT Edge 设备部署 Azure Stream Analytics 服务
查看>>
Android菜鸟的成长笔记(27)——ViewPager的使用
查看>>
Ruby入门
查看>>
GNU make manual 翻译( 一百三十七)
查看>>
[Android Memory] Android系统中查看某个应用当前流量的方法
查看>>
极速理解设计模式系列:17.命令模式(Command Pattern)
查看>>
V4L2 camera 驱动 capture测试程序【转】
查看>>
(转)经纬度坐标转换为屏幕坐标
查看>>
【驱动】USB驱动&#183;入门【转】
查看>>
iOS:APNS推送主要代码
查看>>