【二叉树】后序遍历【Add to List 145. Binary Tree Postorder Traversal】
来源:互联网 发布:seo超级外链工具 编辑:程序博客网 时间:2024/06/06 05:57
题目链接:https://leetcode.com/problems/binary-tree-postorder-traversal/#/description
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: vector<int> ans; // 后序遍历 -> 左右根 vector<int> postorderTraversal(TreeNode* root) { getPostOrder(root); return ans; } void getPostOrder(TreeNode* root){ if(root==NULL) return; getPostOrder(root->left); getPostOrder(root->right); ans.push_back(root->val); return; }};
阅读全文
0 0
- 【二叉树】后序遍历【Add to List 145. Binary Tree Postorder Traversal】
- Binary Tree Postorder Traversal-二叉树的后序遍历
- Binary Tree Postorder Traversal 二叉树的后序遍历
- 二叉树的后序遍历 Binary Tree Postorder Traversal
- Binary Tree Postorder Traversal 二叉树的后序遍历
- binary-tree-postorder-traversal(后序遍历二叉树)
- [LeetCode]145. Binary Tree Postorder Traversal--二叉树的后序遍历
- 二叉树遍历145. Binary Tree Postorder Traversal
- leetcode 145. Binary Tree Postorder Traversal 二叉树后续遍历
- Construct Binary Tree from Inorder and Postorder Traversal 中序和后序遍历二叉树
- LeetCode Binary Tree Postorder Traversal(二叉树的后序遍历 非递归实现)
- Binary Tree Postorder Traversal --二叉树非递归后序遍历(重重)
- Binary Tree Postorder Traversal 二叉树的后序遍历,使用堆栈,非递归
- LeetCode OJ 之 Binary Tree Postorder Traversal (二叉树的后序遍历)
- LintCode Binary Tree Postorder Traversal 二叉树的后序遍历
- LeetCode 145: Binary Tree Postorder Traversal(二叉树的后序遍历,迭代法)
- Binary Tree Postorder Traversal 二叉树的后序遍历(迭代非递归版本)
- 【leetcode】145Binary Tree Postorder Traversal(二叉树非递归后序遍历)
- Convert excel to xml
- exception in initAndListen: 29 Data directory /data/db not found., terminating
- 【MyBatis学习01】宏观上把握MyBatis框架
- 背景,尺寸及显示的相关属性
- 添加一个桥设备——br_add_bridge(二)
- 【二叉树】后序遍历【Add to List 145. Binary Tree Postorder Traversal】
- Jenkins+Tomcat + Gradle + Tinker + Walle + 360加固 + fir.im 持续集成,自动构建
- Kettle生成0到10随机数
- jquery动态添加删除div 新添加的为什么删不掉
- gets()和scanf的区别
- 程序员接私活儿注意事项
- Servlet Jsp三天速成大纲
- Scala基本语法(四)
- NKOJ P2376【NOIP无压力模拟赛5】蜘蛛展览