LCS_Dynamic_Programming

所属分类:数据结构
开发工具:Visual C++
文件大小:4KB
下载次数:69
上传日期:2006-05-25 20:34:55
上 传 者supertomcruise
说明:  LCS(最长公共子序列)问题可以简单地描述如下: 一个给定序列的子序列是在该序列中删去若干元素后得到的序列。给定两个序列X和Y,当另一序列Z既是X的子序列又是Y的子序列时,称Z是序列X和Y的公共子序列。例如,若X={A,B,C,B,D,B,A},Y={B,D,C,A,B,A},则序列{B,C,A}是X和Y的一个公共子序列,但它不是X和Y的一个最长公共子序列。序列{B,C,B,A}也是X和Y的一个公共子序列,它的长度为4,而且它是X和Y的一个最长公共子序列,因为X和Y没有长度大于4的公共子序列。 最长公共子序列问题就是给定两个序列X={x1,x2,...xm}和Y={y1,y2,...yn},找出X和Y的一个最长公共子序列。对于这个问题比较容易想到的算法是穷举,对X的所有子序列,检查它是否也是Y的子序列,从而确定它是否为X和Y的公共子序列,并且在检查过程中记录最长的公共子序列。X的所有子序列都检查过后即可求出X和Y的最长公共子序列。X的每个子序列相应于下标集{1,2,...,m}的一个子集。因此,共有2^m个不同子序列,从而穷举搜索法需要指数时间。
(LCS (longest public sequences) can be simply described as follows : given a sequence of sequences in the sequence is deleted after some element of the sequence. Given two sequences X and Y, Z is another sequence of the X-Y sequence is the sequences, Z is said X and Y series of public sequences. For example, if X = (A, B, C, B, D, B, A), (Y = B, D, C, A, B, A), the sequence (B, C, A) X and Y is a public sequences, it is not X and Y in a public longest sequences. Sequence (B, C, B, A) X and Y is a public sequences, and its length is 4. but it is the X and Y for a public longest sequence, X and Y because no greater than the length of the four sequences in public. The longest public sequences problem is given two sequences X = (x1, x2, ...) xm and Y = (y1, y2, ... yn), to identify X and Y in a)

文件列表:
LCS_Dynamic_Programming.doc (29696, 2006-05-25)

近期下载者

相关文件


收藏者