Binary Tree Postorder Traversal
来源:互联网 发布:网络攻防平台 编辑:程序博客网 时间:2024/05/20 21:23
Given a binary tree, return the postorder traversal of its nodes' values.
Given binary tree {1,#,2,3}
,
1 \ 2 / 3
/** * Created by JZloveSnow on 16/3/7. */class Solution16 { public ArrayList<Integer> postorderTraversal(TreeNode root) { ArrayList<Integer> result = new ArrayList<Integer>(); reverse(root, result); return result; } private void reverse(TreeNode root, ArrayList<Integer> result) { if (root == null) return; reverse(root.left, result); reverse(root.right, result); result.add(root.val); }}
0 0
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal
- spring mvc IE8下JSP页面form表单提交后台不能获取值
- 258. Add Digits
- golang 长短连接处理
- mysql优化笔记
- leetcode:Populating Next Right Pointers in Each Node 【Java】
- Binary Tree Postorder Traversal
- 欢迎使用CSDN-markdown编辑器
- 20160307 Add Digits
- Android JNI编程规范
- android中JNI调用时内存分布以及内存泄露原因分析
- 【nova】centos7下libety版本openstack动态迁移虚拟机
- [译]使用注解处理器生成代码-3 生成源代码
- 第2章 jQuery之基础核心
- 五大常用算法之一--分治算法