Skip to content

Commit 386ba77

Browse files
committed
Update dynamic programming.
1 parent 8131bd7 commit 386ba77

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/main/java/edu/emory/cs/dynamic/lcs/LCSDynamic.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected String solve(char[] c, char[] d, int i, int j) {
3030
* @param d the second string.
3131
* @return the dynamic table populated by estimating the # of LCSs in the grid of the two specific strings.
3232
*/
33-
private int[][] createTable(char[] c, char[] d) {
33+
protected int[][] createTable(char[] c, char[] d) {
3434
final int N = c.length, M = d.length;
3535
int[][] table = new int[N][M];
3636

@@ -41,7 +41,7 @@ private int[][] createTable(char[] c, char[] d) {
4141
return table;
4242
}
4343

44-
private String solve(char[] c, char[] d, int i, int j, int[][] table) {
44+
protected String solve(char[] c, char[] d, int i, int j, int[][] table) {
4545
if (i < 0 || j < 0) return "";
4646

4747
// a common sequence is found
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2020 Emory University
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package edu.emory.cs.dynamic.lcs;
17+
18+
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
/**
23+
* @author Jinho D. Choi ({@code jinho.choi@emory.edu})
24+
*/
25+
public class LCSQuiz extends LCSDynamic {
26+
/**
27+
* @param a the first string.
28+
* @param b the second string.
29+
* @return a list of all longest common sequences between the two strings.
30+
*/
31+
public List<String> solveAll(String a, String b) {
32+
// TODO: to be filled
33+
return new ArrayList<>();
34+
}
35+
}
36+

0 commit comments

Comments
 (0)