EricYang

Tech Spot of Eric

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

2012年5月3日

摘要: O(n)回文子串算法 这里,我介绍一下O(n)回文串处理的一种方法。Manacher算法.原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-palindrome-sub-string/ 其实原文说得是比较清楚的,只是英文的,我这里写一份中文的吧。 首先:大家都知道什么叫回文串吧,这个算法要解决的就是一个字符串中最长的回文子串有多长。这个算法可以在O(n)的时间复杂度内既线性时间复杂度的情况下,求出以每个字符为中心的最长回文有多长, 这个... 阅读全文
posted @ 2012-05-03 22:43 Eric-Yang 阅读(354) 评论(0) 推荐(0)

摘要: PalindromeTime Limit:3000MSMemory Limit:65536KTotal Submissions:41570Accepted:14164DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of 阅读全文
posted @ 2012-05-03 22:40 Eric-Yang 阅读(277) 评论(0) 推荐(0)

摘要: SticksTime Limit:1000MSMemory Limit:10000KTotal Submissions:95592Accepted:21482DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and 阅读全文
posted @ 2012-05-03 21:37 Eric-Yang 阅读(611) 评论(1) 推荐(0)

摘要: Eating TogetherTime Limit:1000MSMemory Limit:65536KTotal Submissions:4383Accepted:2149DescriptionThe cows are so very silly about their dinner partners. They have organized themselves into three groups (conveniently numbered 1, 2, and 3) that insist upon dining together. The trouble starts when they 阅读全文
posted @ 2012-05-03 17:10 Eric-Yang 阅读(215) 评论(0) 推荐(0)

摘要: http://www.wutianqi.com/?p=1850引出:问题描述:给出一个序列a1,a2,a3,a4,a5,a6,a7….an,求它的一个子序列(设为s1,s2,…sn),使得这个子序列满足这样的性质,s1<s2<s3<…<sn并且这个子序列的长度最长。输出这个最长的长度。(为了简化该类问题,我们将诸如最长下降子序列及最长不上升子序列等问题都看成同一个问题,其实仔细思考就会发现,这其实只是<符号定义上的问题,并不影响问题的实质)例如有一个序列:1 7 3 5 9 4 8,它的最长上升子序列就是 1 3 4 8 长度为4.分析:这题目是经典的DP题目,也 阅读全文
posted @ 2012-05-03 15:39 Eric-Yang 阅读(174) 评论(0) 推荐(0)

摘要: http://jsonviewer.codeplex.com/解析Openstack返回JSON消息,非常不错 阅读全文
posted @ 2012-05-03 11:04 Eric-Yang 阅读(1783) 评论(0) 推荐(0)

摘要: 1、 JAVA:Abstract class 和interface 的相同和不同的地方 ?2、 java.util.Calender是一个Abstract class,但是可以使用getInstace()方法获取一个calender.这个是否与Abstract class不能创建实例冲突,为什么?3、 构造函数和普通函数的区别。当一个类拥有多个构造函数,是否可以在一个构造函数中调用另一个构造函数?怎么做?4、 求输出结果public class Test1 { public static void main(String[] args){ char kai='开'; char 阅读全文
posted @ 2012-05-03 09:16 Eric-Yang 阅读(207) 评论(0) 推荐(0)

摘要: 阅读全文
posted @ 2012-05-03 09:14 Eric-Yang 阅读(136) 评论(0) 推荐(0)