【题目】
Sort a linked list using insertion sort.
【题意】
用插入排序方法排序链表
【思路】
直接搞...
分类:
其他好文 时间:
2014-07-02 08:33:49
阅读次数:
200
后缀自动机(SAM)
搜了网上,多介绍应用,[3]算是一个比严格的定义性描述,并给出了证明。但是这个证明我并未看懂,下面综合一些资料给一些个人的直观但不失严谨的理解。
给定一个串A的后缀自动机是一个有限状态自动机(DFA),它能够且仅能够接受A的后缀,并且我们要求它的状态数最少。
设n=|A|, 状态数:st=[n+1,2n-1], 边数:eg=[n,3n-4]。构造:空间复杂度:26*st...
分类:
其他好文 时间:
2014-07-02 08:50:12
阅读次数:
338
【题目】
Sort a linked list in O(n log n) time using constant space complexity.
【题意】
排序一个链表,要求时间复杂度O(nlogn),使用常量空间
【思路】
nlogn的复杂度,用归并排序求解...
分类:
其他好文 时间:
2014-07-02 09:25:40
阅读次数:
252
UVA12709 Falling Ants(超级大水题)...
分类:
其他好文 时间:
2014-07-02 06:52:50
阅读次数:
196
【题目】
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
ExecutorService接口使用submit方法会返回一个Future对象,Future表示异步计算的结果。它提供了检查计算是否完成的方法,以等待计算的完成,并获取计算的结果。计算完成后只能使用get方法来获取结果,如有必要,计算完成前可以阻塞此方法。取消则由cancel方法来执行。还提供了其他方法,以确定任务是正常完成还是被取消了。一旦计算完成,就不能再取消计算。如果为了可取消性而使用Fu...
分类:
其他好文 时间:
2014-07-02 07:17:30
阅读次数:
201
英语渣就是这点不好。。。
巨恶心这种描述多的题。。
大意就是求 从一个点出发,到某些点,然后又从那些点返回的距离之和的 最小值。
Dijkstra+邻接矩阵。 正向建图,求出出发距离,然后swap边,求出 返回距离。
注意的是 车可能有重复的。某个点有多少车就需要乘以车的数量。
#include
#include
#include
#include
#in...
分类:
其他好文 时间:
2014-07-02 07:16:49
阅读次数:
253
【题目】
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Some examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
["4", "13", "5", "/...
分类:
其他好文 时间:
2014-07-02 07:43:36
阅读次数:
212
题目给你一个N,让你求 两个数字 A,B,且 A>=B
N的范围是 3*10^7大的吓人一开始没敢想构造,因为就算构造开的数组也太大了,已经10^7了,后来想了半天在^运算这里也没有想出来什么,所以没办法还是大胆构造吧,构造就去按照他题目的意思来了,构造两个数字 i,j其中j是i的倍数,那么j + i与i的最大公约数肯定是i了,那么(j+i)^i == i这样构造出来的就算满足了,然...
分类:
其他好文 时间:
2014-07-02 08:32:37
阅读次数:
217
【题目】
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 constitutes a word?
A sequence of non-space characters constitutes a word....
分类:
其他好文 时间:
2014-07-02 08:34:34
阅读次数:
170
重载与命名空间(学习笔记)...
分类:
其他好文 时间:
2014-07-02 09:05:51
阅读次数:
184
题目如下:
Slash Maze
By filling a rectangle with slashes (/) and backslashes (), youcan generate nice little mazes. Here is an example:
As you can see, paths in the maze cann...
分类:
其他好文 时间:
2014-07-02 09:07:46
阅读次数:
186
分析:
2的方幂是一种...
分类:
其他好文 时间:
2014-07-02 09:07:08
阅读次数:
191
RecyclerView 是 android-support-v7-21 版本中新增的一个 Widgets, 还有一个 CardView 会在下次介绍使用。官方介绍 RecyclerView 是 ListView 的升级版本,更加先进和灵活。我们写一个简单的实例例,来看一下究竟有多先进和灵活。
build.gradle 配置
android {
compileSdkVersion '...
分类:
其他好文 时间:
2014-07-02 07:00:44
阅读次数:
230
Cocos2d-x v3.1项目创建(三) Cocos2d-x官方为我们提供了用于创建、编译、运行和部署的一套命令行的工具集,也就是上篇文章中我们所提到的Cocos2d-Console,它位于我们的引擎目录下的tools子目录中。本篇文章主要要说明的是如何创建Cocos2d-x项目,所以对于编译、运行和部署就不做介绍了。以后项目的编译、运行和部署我们都将在ADT开发环境中进行,但...
分类:
其他好文 时间:
2014-07-02 08:14:30
阅读次数:
188
错误信息:
Error
Cannot display data
The data cannot be displayed: there is no viewpoint application for the data
错误出现情景:
在对程序做Hardware Event-based Sampling Analysis 0分析时,出现上述错误。
错误解决方法:
删...
分类:
其他好文 时间:
2014-07-02 09:02:56
阅读次数:
337
题目大意:
求可覆盖的出现k次的子串的最大长度。
思路分析:
同样是二分答案的长度,然后扫描height判断是否成立。
#include
#include
#include
#include
#define maxn 1000005
using namespace std;
int str[maxn];
int sa[maxn],t1[maxn],t2[maxn]...
分类:
其他好文 时间:
2014-07-02 09:02:19
阅读次数:
258