二叉树的中序遍历
来源:互联网 发布:jquery.dialog.js 编辑:程序博客网 时间:2024/06/11 08:41
public ArrayList<Integer> inorderTraversal(TreeNode root) { Stack<TreeNode> stack = new Stack<TreeNode>(); ArrayList<Integer> result = new ArrayList<Integer>(); TreeNode curt = root; while (curt != null || !stack.empty()) { while (curt != null) { stack.add(curt); curt = curt.left; } curt = stack.peek(); stack.pop(); result.add(curt.val); curt = curt.right; } return result; }}
阅读全文
0 0
- 二叉树的中序遍历
- 二叉树的中序遍历
- 线索二叉树的中序遍历
- 有关二叉树的中序遍历
- 二叉树的中序遍历
- 排序二叉树的中序遍历
- 二叉树的中序遍历算法
- 题目:二叉树的中序遍历
- 二叉树的中序遍历
- 二叉树的中序遍历
- 二叉树的中序遍历
- LintCode -- 二叉树的中序遍历
- lintcode 二叉树的中序遍历
- 二叉树的前后中序遍历
- 二叉树的中序遍历
- 二叉树的中序遍历
- lintcode:二叉树的中序遍历
- lintcode,二叉树的中序遍历
- 腾讯云部署
- Grails 国际化
- Class.forName()用法详解
- 前端AngularJS的POST请求,后端SpringMVC接收数据的小坑
- Logistic Regression
- 二叉树的中序遍历
- Web.xml配置详解之listener
- Linux 网络编程笔记(3)——进程间通信
- JAVA计算器
- Android 6.0的新特性及权限机制的详解
- 【转】[C++]LARGE_INTEGER 类型使用
- 人工智能资源
- Mathtype与word2016不兼容问题最新解决办法
- Android 手机TV端屏幕共享助手