字典树:
字典树 即Tire树,以一个空的头结点分若干的分支,来存放数据,虽浪费了大量内存,但是查找速度非常快。
匹配 时间复杂度 O(n) n = strlen(a);
字典树分 3步,建树、插入、查找
当然有时候,建树的选择是很重要的一点,尽量本着少往字典树上添加节点的原则,容易爆!!!
列入下面这题,用m建树,n来查找,即可AC,如果用n来建...
分类:
其他好文 时间:
2014-06-09 23:42:44
阅读次数:
295
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the target, whe...
分类:
其他好文 时间:
2014-06-09 23:14:45
阅读次数:
264
Posted in Linux Kernel at November 8th, 2012 /
1 Comment ? 我以前写过一篇介绍 tunnel 的文章,只是做了大体的介绍。里面多数 tunnel
是很容易理解的,因为它们多是一对一的,换句话说,是直接从一端到另一端。比如 IPv6 over ...
分类:
其他好文 时间:
2014-06-09 17:35:09
阅读次数:
211
FastReport是一款优秀的报表控件,由俄罗斯开发,国内有代理商。Qt环境下可实现报表功能的还有一款叫NCReport,也是收费控件,比较来比较去还是觉得前者功能强点。网上讲解此控件在Qt中使用的文章比较少,故在此做下记录:概述:1.
FastReport版本有VCL, .NET, COM/Ac...
分类:
其他好文 时间:
2014-06-09 15:34:10
阅读次数:
973
Ubuntu装完后要做的几件事改hosts无论哪里,改hosts都是第一件事,没hosts咋google。没google咋活。在终端输入命令sudo
gedit /etc/hosts在# The following lines are desirable for IPv6 capable hosts...
分类:
其他好文 时间:
2014-06-09 15:16:01
阅读次数:
225
今天开始刷leetcode上的题,争取校招前刷过一遍,从AC率最高的题目开始刷,不废话了,看题题目:Single
NumberGiven an array of integers, every element appearstwiceexcept for one. Find
that single ...
分类:
其他好文 时间:
2014-06-09 12:57:45
阅读次数:
260
今天在311开了一个集训队的会议,自己也打算不再做下去了,也可以说是压根没怎么做过ACM。在算法学习方面,还是学的比较水的。当然在这里也要感谢一下,带我进入ACM的陈胖子,是一个老乡,当时我也没想要进入ACM,后来整天跟陈胖子还有Lisz混在一起,但是那时候我的能力太弱了,学习了很久才进入了AC.....
分类:
其他好文 时间:
2014-06-08 23:18:06
阅读次数:
189
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-06-08 15:30:28
阅读次数:
227
题目如下:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
click to show clarification.
Clarification:
What co...
分类:
其他好文 时间:
2014-06-08 14:58:13
阅读次数:
231
题目
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321。
解题思路:
颠倒一个整数中数字的位置,哈哈,类似翻转字符串一样,只不过整数需要计算,需要考虑溢出,其他无而。写出代码不难,只是溢出的时候怎么办,我这里是按照返回-1处理的,在leetcode上可以AC。
代码实现:...
分类:
其他好文 时间:
2014-06-08 14:47:58
阅读次数:
257