Binary Tree Postorder Traversal
Total Accepted: 28560 Total
Submissions: 92333My Submissions
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given...
分类:
其他好文 时间:
2014-09-05 16:09:01
阅读次数:
172
//中序遍历int inorder_tree_walk(BinTreeNode * root){ if(root == NULL){ return -1; } stack s; BinTreeNode * p = root; while(!s.empty(...
分类:
其他好文 时间:
2014-09-05 14:15:11
阅读次数:
142
前序遍历二叉树int preorder_tree_walk(BinTreeNode * root){ if(root == NULL){ return -1; } stack s; BinTreeNode * p = root; while(!s.empt...
分类:
其他好文 时间:
2014-09-05 14:10:51
阅读次数:
170
进入MongoDB下载中心:http://www.mongodb.org/downloadsWe recommend using these binary distributions (官方推荐使用二进制版本!)根据自己的实际系统环境,下载所要的文件,我的是Linux 64-bit.wget htt...
分类:
数据库 时间:
2014-09-05 12:36:11
阅读次数:
282
public class Solution { public List postorderTraversal(TreeNode root) { List result = new ArrayList(); Stack nodeStack = new Stack();...
分类:
其他好文 时间:
2014-09-05 02:08:10
阅读次数:
166
bool helper(TreeNode *pA, TreeNode *pB) { if (!pA && !pB) return true; if (!pA || !pB) return false; // only one has node in a tree and...
分类:
其他好文 时间:
2014-09-04 23:36:10
阅读次数:
308
一开始的思路是:中序遍历+判断遍历后的数组,时间空间都不是最优果然超时了 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * ...
分类:
其他好文 时间:
2014-09-04 23:35:50
阅读次数:
393
递归 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode...
分类:
其他好文 时间:
2014-09-04 22:16:00
阅读次数:
228
前言:引用某某的话——我是猪QAQ。。。。。题意就不复述了。解题思路:一般的建树,求和。离散化:用另一个数组sor[]记录原数组,sort一遍,用unique去重,用sor[]数组元素下标,代替原数组中元素,然后在sor[]数组里二分查找元素,last[]数组记录第i个元素上一次出现的位置。离线处理...
分类:
其他好文 时间:
2014-09-04 20:49:20
阅读次数:
323
Nearest Common AncestorsTime Limit:1000MSMemory Limit:10000KTotal Submissions:18598Accepted:9860DescriptionA rooted tree is a well-known data structur...
分类:
其他好文 时间:
2014-09-04 18:59:19
阅读次数:
156