100 {
+
101
+
102 int **
L, **B, j, l1, l2;
103
-
-
105 perror("calloc: ");
-
106 exit(1);
-
107 }
-
108 if (!B) {
-
109 perror("calloc: ");
-
110 exit(1);
-
111 }
-
112 for (j = 0; j <= l1; j++) {
-
113 L[j] = (
int *)
calloc(l2+1,
sizeof(
int));
-
-
115 perror("calloc: ");
-
116 exit(1);
-
117 }
-
118 B[j] = (
int *)
calloc(l2+1,
sizeof(
int));
-
-
120 perror("calloc: ");
-
121 exit(1);
-
122 }
-
123 }
-
124
-
-
-
127
-
128 assert(
L[l1][l2] == 27);
-
129 assert(strcmp(lcs, "CGTTCGGCTATGCTTCTACTTATTCTA") == 0);
-
130
-
131 printf("S1: %s\tS2: %s\n", s1, s2);
-
132 printf(
"LCS len:%3d\n",
L[l1][l2]);
-
133 printf("LCS: %s\n", lcs);
-
134
-
-
136 for (j = 0; j <= l1; j++)
-
-
-
-
140
-
141 printf("All tests have successfully passed!\n");
-
142}
-
char * lcsbuild(const char *s1, int l1, int l2, int **L, int **B)
@breif Builds the LCS according to B using a traceback approach
Definition: lcs.c:59
-
void lcslen(const char *s1, const char *s2, int l1, int l2, int **L, int **B)
@breif Computes LCS between s1 and s2 using a dynamic-programming approach
Definition: lcs.c:27
+
104 char *s1 = "ACGGTGTCGTGCTATGCTGATGCTGACTTATATGCTA";
+
105 char *s2 = "CGTTCGGCTATCGTACGTTCTATTCTATGATTTCTAA";
+
106 char *lcs;
+
107
+
108 l1 = strlen(s1);
+
109 l2 = strlen(s2);
+
110
+
111 L = (
int **)
calloc(l1+1,
sizeof(
int *));
+
112 B = (
int **)
calloc(l1+1,
sizeof(
int *));
+
113
+
+
115 perror("calloc: ");
+
116 exit(1);
+
117 }
+
118 if (!B) {
+
119 perror("calloc: ");
+
120 exit(1);
+
121 }
+
122 for (j = 0; j <= l1; j++) {
+
123 L[j] = (
int *)
calloc(l2+1,
sizeof(
int));
+
+
125 perror("calloc: ");
+
126 exit(1);
+
127 }
+
128 B[j] = (
int *)
calloc(l2+1,
sizeof(
int));
+
+
130 perror("calloc: ");
+
131 exit(1);
+
132 }
+
133 }
+
134
+
+
+
137
+
138 assert(
L[l1][l2] == 27);
+
139 assert(strcmp(lcs, "CGTTCGGCTATGCTTCTACTTATTCTA") == 0);
+
140
+
141 printf("S1: %s\tS2: %s\n", s1, s2);
+
142 printf(
"LCS len:%3d\n",
L[l1][l2]);
+
143 printf("LCS: %s\n", lcs);
+
144
+
+
146 for (j = 0; j <= l1; j++)
+
147 {
+
+
149 }
+
+
+
152
+
153 printf("All tests have successfully passed!\n");
+
154}
+
char * lcsbuild(const char *s1, int l1, int l2, int **L, int **B)
Builds the LCS according to B using a traceback approach.
Definition: lcs.c:64
+
void lcslen(const char *s1, const char *s2, int l1, int l2, int **L, int **B)
Computes LCS between s1 and s2 using a dynamic-programming approach.
Definition: lcs.c:30
#define free(ptr)
This macro replace the standard free function with free_dbg.
Definition: malloc_dbg.h:26
diff --git a/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.map b/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.map
index 3b88f0c8..652ad681 100644
--- a/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.map
+++ b/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.map
@@ -1,6 +1,6 @@
diff --git a/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.md5 b/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.md5
index 4111832a..2b689b4b 100644
--- a/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.md5
+++ b/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.md5
@@ -1 +1 @@
-6f3f9dfa107f08ce6a4553449a150e13
\ No newline at end of file
+a914b9badc6f3982f4c4215c81bb2459
\ No newline at end of file
diff --git a/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg b/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg
index 35f11d95..1ada304c 100644
--- a/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg
+++ b/db/de1/lcs_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.svg
@@ -35,7 +35,7 @@