Robin's Log

那能得叙曲幽静,唯有念头笑巍峨

2005年03月

原创 最大子序列和线性算法

最大子序列和线性算法 问题描述: 给定整数A1, A2,……AN (可能有负数),求I到j的最大值。 例如: -2, 11, -4, 13, -5, -2时答案为20 对于这个问题的算法有很多,当然我要说的是使用“动态规划”算法实现的程序,对于这个算法,我可以说很多人都曾经想到,但是没有想全(因为我就是这样的)。还有一点对于这个问题的动态规划的解法是非常经典的,她的时间复杂度是O(n),也就是线性的。而对于穷举法它的时间复杂度可是O(n3), 这样看来可以巨大的改进了。 阅读全文>

发表于 @ 2005年03月27日 21:06:00|评论(loading...)|编辑

原创 最长公共子序列

若给定序列X={x1,x2,…,xm},则另一序列Z={z1,z2,…,zk},是X的子序列是指存在一个严格递增下标序列{i1,i2,…,ik}使得对于所有j=1,2,…,k有:zj=xij。例如,序列Z={B,C,D,B}是序列X={A,B,C,B,D,A,B}的子序列,相应的递增下标序列为{2,3,5,7}。 •给定2个序列X和Y,当另一序列Z既是X的子序列又是Y的子序列时,称Z是序列X和Y的公共子序列。 •给定2个序列X={x1,x2,…,xm}和Y={y1,y2,…,yn},找出X和Y的最长公共子序列。 阅读全文>

发表于 @ 2005年03月24日 11:59:00|评论(loading...)|编辑

原创 The shifting preoccupations of the 20th century and the early years of the 21st.

Very few words are coined in isolation. Each neologism holds a clue, however faint, of the time in which it was created. The following choice of a single word from each of the last hundred years is inevitably subjective, since hundreds of new words are being created at any one time. Nonetheless, collectively these words give a distinct picture of the shifting preoccupations of the 20th century and the early years of the 21st. The dates of CHEESEBURGER or MOBILE PHONE may surprise. 阅读全文>

发表于 @ 2005年03月14日 23:17:00|评论(loading...)|编辑

原创 求出一列数中的“逆序对”

求出一列数中的“逆序对”的个数;所谓“逆序对”就是指数的大小与其在序列中的顺序相反的一对数;例 如:中“逆序对”有,,,,这5个;要求时间复杂度为O(nlogn); 阅读全文>

发表于 @ 2005年03月12日 10:31:00|评论(loading...)|编辑

Csdn Blog version 3.1a
Copyright © Robin Li