[leetcode-二叉树后序遍历]--145. Binary Tree Postorder Traversal
来源:互联网 发布:网络攻防大赛 编辑:程序博客网 时间:2024/05/17 22:06
Question 145. Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes’ values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [3,2,1].二叉树后序遍历
直接给出代码了:
/** * @param root * @return */public static List<Integer> postorderTraversal(TreeNode root) { List<Integer> post = new ArrayList<Integer>(); postHelper(root, post); return post;}private static void postHelper(TreeNode root, List<Integer> post) { if(root==null) return; postHelper(root.left, post); postHelper(root.right, post); post.add(root.val);}
完整代码github地址:
https://github.com/leetcode-hust/leetcode/blob/master/louyuting/src/leetcode/Question145.java
0 0
- LeetCode 145. Binary Tree Postorder Traversal(二叉树后序遍历)
- 145.leetcode Binary Tree Postorder Traversal(easy)[二叉树后序遍历]
- [leetcode-二叉树后序遍历]--145. Binary Tree Postorder Traversal
- leetcode 145. Binary Tree Postorder Traversal 二叉树后续遍历
- Leetcode: Binary Tree Postorder Traversal(二叉树后序遍历)
- Leetcode Binary Tree Postorder Traversal 二叉树后序遍历
- LeetCode 145 Binary Tree Postorder Traversal(二叉树后序遍历)
- 145.Binary Tree Postorder Traversal (二叉树后序遍历)
- 二叉树后序遍历——145. Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal 二叉树后续遍历@LeetCode
- [leetcode]Binary Tree Postorder Traversal 二叉树后序非递归遍历
- 二叉树遍历145. Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal 非递归实现二叉树后序遍历
- LeetCode145——Binary Tree Postorder Traversal二叉树后序遍历
- [LeetCode]145. Binary Tree Postorder Traversal--二叉树的后序遍历
- LeetCode Binary Tree Postorder Traversal 二叉树后序遍历 递归和非递归解法
- 【LeetCode】Binary Tree Postorder Traversal 二叉树后序遍历递归以及非递归算法
- leetcode 145. Binary Tree Postorder Traversal 后序遍历
- 浅析Apache Spark Caching和Checkpointing
- Spring security实现权限管理
- 项目架构分析-web.xml文件解读
- Linux df du的区别
- IOS项目集成Weex
- [leetcode-二叉树后序遍历]--145. Binary Tree Postorder Traversal
- JS中call()和apply()的目的及用法
- display和visibility的用法区别
- 如何利用fleet单元文件为CoreOS集群创建高灵活性服务
- js计算两个日期相差天数
- window下安装redis cluster 集群
- 架构设计:系统间通信(16)——服务治理与Dubbo 中篇(预热)
- View体系之View的滑动
- java读写文件