算法:1.
对root的左子树做处理,让左子树的根节点作为,根节点的右子树,并让右子树作为左子树根节点的右子树的子树2. 递归遍历右子树public void
flatten(TreeNode root) { if(root==null){ return; ...
分类:
其他好文 时间:
2014-05-26 23:39:49
阅读次数:
253
出题:数组中有一个数字出现的次数超过了数组长度的一半,请找出这个数字;分析:解法1:首先对数组进行排序,时间复杂度为O(NlogN),由于有一个数字出现次数超过了数组的一半,所以如果二分数组的话,划分元素肯定就是这个数字;解法2:首先创建1/2数组大小的Hash
Table(哈希表可以替代排序时间,...
分类:
其他好文 时间:
2014-05-26 23:23:48
阅读次数:
453
modesecurity
的特征:https://github.com/SpiderLabs/owasp-modsecurity-crs/tree/master/base_rulessnort的规则:http://cs.uccs.edu/~cs591/ids/snort/snort2_9_0/rul...
分类:
其他好文 时间:
2014-05-26 22:45:06
阅读次数:
248
题目链接题意:思路: 1 #include 2 #include 3 #include 4
#include 5 #include 6 using namespace std; 7 const int mo = 1000000000 + 7; 8
int dp[110][110][110]...
分类:
其他好文 时间:
2014-05-26 14:02:48
阅读次数:
264
1 /** 2 * 把返回的数据集转换成Tree 3 * @param array $list
要转换的数据集 4 * @param string $pid parent标记字段 5 * @param string $level level标记字段 6 *
@return array 7...
分类:
其他好文 时间:
2014-05-26 14:01:51
阅读次数:
225
原题地址:https://oj.leetcode.com/problems/recover-binary-search-tree/题意:Two
elements of a binary search tree (BST) are swapped by mistake.Recover the
tree...
分类:
编程语言 时间:
2014-05-26 13:25:43
阅读次数:
261
基本上一次过,要注意边界条件的问题:如果在recursion里有两个参数int begin, end,
递归写作recursion(num, mid+1, end), 因为+号的原因,递归中是会出现begin > end
的情况的,所以考虑初始条件的时候应该要考虑充分。 1 /** 2 * Def....
分类:
其他好文 时间:
2014-05-26 12:12:49
阅读次数:
257
Given a strings1, we may represent it as a
binary tree by partitioning it to two non-empty substrings recursively.Below is
one possible representation...
分类:
其他好文 时间:
2014-05-26 11:24:36
阅读次数:
214
海量数据处理策略之一—Hash映射 + Hash_map统计 + 堆/快速/归并排序...
分类:
其他好文 时间:
2014-05-23 01:18:40
阅读次数:
414
题目:http://poj.org/problem?id=1226
http://acm.hdu.edu.cn/showproblem.php?pid=1238
其实用hash+lcp可能也可以,甚至可能写起来更快,不过我没试,我最近在练习后缀数组,所以来练手
后缀数组的典型用法之一----------------后缀数组+lcp+二分
思路:1、首先将所有的字符串每读...
分类:
其他好文 时间:
2014-05-22 17:14:08
阅读次数:
289