From caa35c9eb6550d0397975319b381189bb3e73e3c Mon Sep 17 00:00:00 2001 From: Rajashree Parhi Date: Sun, 7 Oct 2018 21:57:16 +0530 Subject: [PATCH] implemented lcs in C language --- .../longest_common_subsequence/C/long_comm_subs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dynamic_programing/longest_common_subsequence/C/long_comm_subs.c b/dynamic_programing/longest_common_subsequence/C/long_comm_subs.c index 77702c3..c68c481 100644 --- a/dynamic_programing/longest_common_subsequence/C/long_comm_subs.c +++ b/dynamic_programing/longest_common_subsequence/C/long_comm_subs.c @@ -20,15 +20,14 @@ void print(int i,int j) } void lcs() -{ - m=strlen(x); +{ m=strlen(x); n=strlen(y); for(i=0;i<=m;i++) c[i][0]=0; for(i=0;i<=n;i++) c[0][i]=0; - //c, u and l denotes cross, upward and downward directions respectively + for(i=1;i<=m;i++) for(j=1;j<=n;j++) {