注:后序遍历是较麻烦的一个,不可大意。关键两点: 1.要走到 p->left | p->right ==0, 2.每次出栈出两个结点。
分类:
其他好文 时间:
2014-08-10 01:45:39
阅读次数:
286
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
zigzag层序遍历树
For example:
Given binary...
分类:
其他好文 时间:
2014-08-09 23:19:59
阅读次数:
363
1 #include 2 #include 3 using namespace std; 4 int ans; 5 int max1=0; 6 int a[200010]; 7 struct Node{ 8 int left; 9 int right;10 int max;...
分类:
其他好文 时间:
2014-08-09 22:55:19
阅读次数:
283
1 #include 2 using namespace std; 3 const int N=3000; 4 struct SubNode 5 { 6 int left,right; 7 int value; 8 } 9 struct Node10 {11 int lef...
分类:
其他好文 时间:
2014-08-09 18:30:18
阅读次数:
191
大致思想:根据给定经纬度(lat,lng)求出其左上角(left_top),右上角(right_top),左下角(left_bottom),右下角(right_bottom)的四个位置。所有在这个区域的范围都在该点附近。参照:http://blog.charlee.li/location-searc...
分类:
其他好文 时间:
2014-08-09 18:08:48
阅读次数:
252
文本的定位水平与垂直定位:当使用strokeText()和fillText()绘制文本时,指定了所绘文本的X与Y坐标,还有textAlign与textBaseline两个属性textAlign:start(默认) center end left right,当canvas元素的dir属性是ltr时,...
分类:
Web程序 时间:
2014-08-09 02:30:36
阅读次数:
240
Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a...
分类:
其他好文 时间:
2014-08-09 00:02:06
阅读次数:
201
Binary Tree Level Order Traversal IIGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level...
分类:
其他好文 时间:
2014-08-08 23:53:16
阅读次数:
221