Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-07-02 22:10:42
阅读次数:
262
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-07-02 21:13:05
阅读次数:
170
解决emacs中cscope的定义键无效1、cscope的el插件为xcscope.el,通过“sudo find / -name xcscope.el”查找该文件所在的位置2、打开xcscope.el查找“(define-key cscope:map "\C-css" 'cscope-find-t...
分类:
其他好文 时间:
2014-07-02 18:32:30
阅读次数:
546
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 string s1, s2; 6 getline(cin, s1); 7 getline(cin, s2); 8 while(s1.find(s...
分类:
其他好文 时间:
2014-07-02 17:17:29
阅读次数:
281
Requirement-Driven Linux Shell ProgrammingRequirement-Driven Linux Shell ProgrammingTable of Contents1. Where can I find the basic Material about Linu...
分类:
系统相关 时间:
2014-07-02 13:55:48
阅读次数:
410
#define FIND(struc,e) (int)&(((struc *)0)->e)...
分类:
编程语言 时间:
2014-07-02 08:13:52
阅读次数:
257
题目链接:Find a Way
题目不难,前几天做,当时准备写双向BFS的,后来处理细节上出了点问题,赶上点事搁置了,今天晚上重写的,没用双向,用了两次BFS搜索,和双向BFS 道理差不多,只是这题有个小坑,需要注意
1.Y不能经过M,M不能经过Y,也就是说有Y和M的格子,可以默认为是墙
2.必须是Y和M都能到达的KFC才行,只是其中一个到达不行
例如下列数据;答案既不是22 也不...
分类:
其他好文 时间:
2014-07-02 08:13:15
阅读次数:
197
进入Ubuntu之后打开终端窗口的快捷键是:
ctrl + alt+T:通过这个命令可以打开终端。截图是:
关闭一个终端窗口的方式是:
Alt +F4,在Ubuntu下还可以是exit
对于terminal中的符号,其中的$标识,普通用户时显示的是$,超级管理员对应的符号是:#
截图如下:...
分类:
系统相关 时间:
2014-07-02 07:58:14
阅读次数:
788
Union-Find
动态连接问题描述:
给定一个n个序列的对象,有两种操作:
-Union command:连接两个对象;
-Find/connected query:两个对象是否连接(有路径)
算法实现方式
1.用一个数组保存着每个对象所在的connected component,这种方式可以快速进行FIND,但是在union操作时需要遍历整...
分类:
其他好文 时间:
2014-07-02 07:10:59
阅读次数:
287
【题目】
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
【题意】
给定一堆点,要求找出一条之前上的最大点数
【思路】
没什么好的方法,从每个点P出发,遍历所有的情况
从每个点P出发,斜率相同的点即为统一之前上的点
注意两种特殊情况:
1. 两个点重合(即为同一个点)
...
分类:
其他好文 时间:
2014-07-02 06:52:06
阅读次数:
171