题目链接:https://leetcode.com/problems/binary-tree-postorder-traversal/(非递归实现)二叉树的后序遍历。 1 class Solution 2 { 3 public: 4 vector postorderTraversal(Tre...
分类:
其他好文 时间:
2015-04-05 23:24:15
阅读次数:
160
题目链接:https://leetcode.com/problems/binary-tree-maximum-path-sum/题中要求 maxPathSum(TreeNode *root)函数返回二叉树中最大的"Path Sum"。而这个最大的"Path Sum"可以被分解为三部分之和:"左子树的...
分类:
其他好文 时间:
2015-04-05 23:11:44
阅读次数:
158
题目Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:
Given the following binary tree,
1...
分类:
其他好文 时间:
2015-04-05 22:00:55
阅读次数:
201
BIT(Binary Indexed Tree,BIT) 树状数组。树状数组是一类怎样的数据结构呢?我们知道,树状数组是用来解决动态连续和的查询问题而诞生的。数据结构就是说,给你n个元素的数组a[1],a[2],a[3]....a[n](下标要从1开始)然后,支持以下两种操作: 1.Add...
分类:
编程语言 时间:
2015-04-05 18:42:55
阅读次数:
151
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
ret...
分类:
其他好文 时间:
2015-04-05 16:04:34
阅读次数:
151
使用苹果自带的地图框架,需要在项目中加载MapKit.framework(项目—TARGETS--Build Phases--Link Binary With Libraries),并在头文件中导入
#import
一、MKMapView的常用属性和方法
NSArray *annotations;//保存地图中的大头针
MKCoordinateRegion
region; /...
分类:
其他好文 时间:
2015-04-05 12:03:02
阅读次数:
137
判断一个二叉树是否为平衡二叉树
int Depth(BinTree* root)
{
if(root == NULL)
return 0;
return max(Depth(root->left),Depth(root->right))+1;
}
bool isBalancedBinTree(BinTree* root)
{
if(root ==NULL)
return 1;
i...
分类:
其他好文 时间:
2015-04-05 12:02:53
阅读次数:
104
题目:
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9...
分类:
其他好文 时间:
2015-04-05 12:00:39
阅读次数:
145
题目:
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf
to root).
For example:
Given binary tree {3,9,20,...
分类:
其他好文 时间:
2015-04-05 11:58:39
阅读次数:
111