Lintcode68 Binary Tree Postorder Traversal solution 题解
来源:互联网 发布:甘肃快3遗漏数据分析 编辑:程序博客网 时间:2024/05/28 23:10
【题目描述】
Given a binary tree, return the postorder traversal of its nodes' values.
给出一棵二叉树,返回其节点值的后序遍历。
【题目链接】
www.lintcode.com/en/problem/binary-tree-postorder-traversal/
【题目解析】
二叉树后序遍历。刚接触leetcode时也做过这道题,用了很蠢笨的方法。现在学习discuss里大神们的版本,真的进步很多。下面这个版本是基于上道题目-二叉树先序遍历的。由于后序遍历是left -> right -> root,先序是root -> left -> right, 所以我们改变的只是如何插入结果到list里,以及被压入栈的先后顺序而已。在这里,pop出的结果要插入到list前部,而且要先把左子树压入栈,其次是右子树。
【参考答案】
www.jiuzhang.com/solutions/binary-tree-postorder-traversal/
阅读全文
0 0
- Lintcode68 Binary Tree Postorder Traversal solution 题解
- Lintcode68 Binary Tree Postorder Traversal solution 题解
- Lintcode72 Construct Binary Tree from Inorder and Postorder Traversal solution 题解
- Lintcode72 Construct Binary Tree from Inorder and Postorder Traversal solution 题解
- LeetCode题解:Binary Tree Postorder Traversal
- LeetCode题解-145-Binary Tree Postorder Traversal
- Lintcode66 Binary Tree Preorder Traversal solution 题解
- Lintcode67 Binary Tree Inorder Traversal solution 题解
- Lintcode67 Binary Tree Inorder Traversal solution 题解
- LeetCode 145. Binary Tree Postorder Traversal java solution
- 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
- windows server添加角色
- [NOIP模拟] 路径统计
- STL 双端队列
- ACID特性
- docker之exec
- Lintcode68 Binary Tree Postorder Traversal solution 题解
- C语言学习第四五章
- 追妹一条龙 奉献给各位
- 日常学习
- Java类
- 产品经理分类及职责
- 计算caches文件夹下某个文件夹中的大小
- Python
- 算法题:lintcode#175 翻转二叉树(java)