最长公共子序列算法C语言实现(源程序)

类别:编程语言 点击:0 评论:0 推荐:
#include #include #define N 20 void LCSLength(int m,int n,char x[N+1],char y[N+1],char b[N+1][N+1]); void LCS(int i,int j,char x[N+1],char b[N+1][N+1]); void main() { int lx,ly; char X[N+1],Y[N+1]; int B[N+1][N+1]; scanf("%s",X+1); scanf("%s",Y+1); lx=strlen(X+1); ly=strlen(Y+1); LCSLength(lx,ly,X,Y,B); LCS(lx,ly,X,B); } /* Functions */ void LCSLength(int m,int n,char x[],char y[],char b[N+1][N+1]) { int i,j; int c[N+1][N+1]; for (i=1;i

本文地址:http://com.8s8s.com/it/it24662.htm