Skip to content

Commit b0eaa30

Browse files
committed
commit
1 parent 9e61a02 commit b0eaa30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+462
-1
lines changed

.metadata/.log

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,80 @@ Command-line arguments: -os linux -ws gtk -arch x86_64
111111

112112
!ENTRY org.eclipse.core.resources 2 10035 2017-09-28 08:23:30.011
113113
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
114+
!SESSION 2017-09-28 19:02:39.709 -----------------------------------------------
115+
eclipse.buildId=debbuild
116+
java.version=1.7.0_131
117+
java.vendor=Oracle Corporation
118+
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=zh_CN
119+
Command-line arguments: -os linux -ws gtk -arch x86_64
120+
121+
!ENTRY org.eclipse.core.resources 2 10035 2017-09-28 19:02:46.269
122+
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
123+
124+
!ENTRY org.eclipse.jdt.ui 4 10001 2017-09-28 19:07:33.660
125+
!MESSAGE Internal Error
126+
!STACK 1
127+
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for ArrayBlockingQueue [in ArrayBlockingQueue.class [in java.util.concurrent [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]] ]
128+
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:808)
129+
at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
130+
at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:639)
131+
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:463)
132+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:95)
133+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:75)
134+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:58)
135+
at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:555)
136+
at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
137+
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
138+
!SUBENTRY 1 org.eclipse.jdt.core 4 1012 2017-09-28 19:07:33.663
139+
!MESSAGE Timed out while retrieving the attached javadoc for ArrayBlockingQueue [in ArrayBlockingQueue.class [in java.util.concurrent [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]]
140+
141+
!ENTRY org.eclipse.jdt.ui 4 10001 2017-09-28 19:07:33.868
142+
!MESSAGE Internal Error
143+
!STACK 1
144+
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for Area [in Area.class [in java.awt.geom [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]] ]
145+
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:808)
146+
at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
147+
at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:639)
148+
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:463)
149+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:95)
150+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:75)
151+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:58)
152+
at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:555)
153+
at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
154+
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
155+
!SUBENTRY 1 org.eclipse.jdt.core 4 1012 2017-09-28 19:07:33.868
156+
!MESSAGE Timed out while retrieving the attached javadoc for Area [in Area.class [in java.awt.geom [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]]
157+
158+
!ENTRY org.eclipse.jdt.ui 4 10001 2017-09-28 19:24:17.398
159+
!MESSAGE Internal Error
160+
!STACK 1
161+
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for List [in List.class [in java.util [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]] ]
162+
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:808)
163+
at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
164+
at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:639)
165+
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:463)
166+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:95)
167+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:75)
168+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:58)
169+
at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:555)
170+
at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
171+
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
172+
!SUBENTRY 1 org.eclipse.jdt.core 4 1012 2017-09-28 19:24:17.398
173+
!MESSAGE Timed out while retrieving the attached javadoc for List [in List.class [in java.util [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]]
174+
175+
!ENTRY org.eclipse.jdt.ui 4 10001 2017-09-28 19:39:32.486
176+
!MESSAGE Internal Error
177+
!STACK 1
178+
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for Object [in Object.class [in java.lang [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]] ]
179+
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:808)
180+
at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
181+
at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:639)
182+
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:463)
183+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:95)
184+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:75)
185+
at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:58)
186+
at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:555)
187+
at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
188+
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
189+
!SUBENTRY 1 org.eclipse.jdt.core 4 1012 2017-09-28 19:39:32.486
190+
!MESSAGE Timed out while retrieving the attached javadoc for Object [in Object.class [in java.lang [in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]]]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class LongestCommonSequence {
7+
List list=new ArrayList<>();
8+
public List LCSLength(char[] x,char[] y){
9+
int m=x.length;
10+
int n=y.length;
11+
int[][] c=new int[m][n];
12+
String[][] b=new String[m][n];
13+
14+
for (int i = 1; i < n; i++) {
15+
for (int j = 0; j < n; j++) {
16+
if(x[i]==y[j]){
17+
c[i][j]=c[i-1][j-1]+1;
18+
b[i][j]="↖";
19+
}else if(c[i-1][j] >=c[i][j-1]){
20+
c[i][j]=c[i-1][j];
21+
b[i][j]="↑";
22+
}else{
23+
c[i][j]=c[i][j-1];
24+
b[i][j]="←";
25+
}
26+
}
27+
}
28+
return list;
29+
}
30+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class LongestCommonSequence {
7+
List list=new ArrayList<>();
8+
public List LCSLength(char[] x,char[] y){
9+
int m=x.length;
10+
int n=y.length;
11+
int[][] c=new int[m][n];
12+
String[][] b=new String[m][n];
13+
14+
for (int i = 1; i < n; i++) {
15+
for (int j = 0; j < n; j++) {
16+
if(x[i]==y[j]){
17+
c[i][j]=c[i-1][j-1]+1;
18+
}else if(c[i-1][j] >=c[i][j-1]){
19+
20+
}else{
21+
22+
}
23+
}
24+
}
25+
return list;
26+
}
27+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class LongestCommonSequence {
7+
List list=new ArrayList<>();
8+
public List LCSLength(char[] x,char[] y){
9+
int m=x.length;
10+
int n=y.length;
11+
int[][] c=new int[m][n];
12+
String[][] b=new String[m][n];
13+
14+
for (int i = 1; i < n; i++) {
15+
for (int j = 0; j < n; j++) {
16+
if(x[i]==y[j]){
17+
c[i][j]=c[i-1][j-1]+1;
18+
b[i][j]="↖";
19+
}else if(c[i-1][j] >=c[i][j-1]){
20+
c[i][j]=c[i-1][j];
21+
b[i][j]="↑";
22+
}else{
23+
c[i][j]=c[i][j-1];
24+
b[i][j]="←";
25+
}
26+
}
27+
}
28+
list.add(b);
29+
list.add(c);
30+
return list;
31+
}
32+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class LongestCommonSequence {
7+
List list=new ArrayList<>();
8+
public List LCSLength(char[] x,char[] y){
9+
int m=x.length;
10+
int n=y.length;
11+
int[][] c=new int[m][n];
12+
String[][] b=new String[m][n];
13+
14+
for (int i = 1; i < n; i++) {
15+
for (int j = 0; j < n; j++) {
16+
if(x[i]==y[j]){
17+
c[i][j]=c[i-1][j-1]+1;
18+
}else if(c[i-1][j] >=c[i][j-1]){
19+
c[i][j]=c[i-1][j];
20+
b[i][j]="";
21+
}else{
22+
23+
}
24+
}
25+
}
26+
return list;
27+
}
28+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class LongestCommonSequence {
7+
List list=new ArrayList<>();
8+
public List LCSLength(char[] x,char[] y){
9+
int m=x.length;
10+
int n=y.length;
11+
int[][] c=new int[m][n];
12+
String[][] b=new String[m][n];
13+
14+
for (int i = 1; i < n; i++) {
15+
for (int j = 0; j < n; j++) {
16+
if(x[i]==y[j]){
17+
c[i][j]=c[i-1][j-1]+1;
18+
b[i][j]="";
19+
}else if(c[i-1][j] >=c[i][j-1]){
20+
c[i][j]=c[i-1][j];
21+
b[i][j]="";
22+
}else{
23+
24+
}
25+
}
26+
}
27+
return list;
28+
}
29+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
/**
6+
* 求两个序列的最长公共子序列类
7+
* @author liyafei
8+
*
9+
*/
10+
public class LongestCommonSequence {
11+
List list=new ArrayList<>();
12+
13+
/**
14+
* 求最长公共子序列的方法。
15+
* @param x 序列1
16+
* @param y 序列2
17+
* @return 返回最长公共子序列和标记
18+
*/
19+
public List LCSLength(char[] x,char[] y){
20+
int m=x.length;
21+
int n=y.length;
22+
int[][] c=new int[m][n];
23+
String[][] b=new String[m][n];
24+
25+
for (int i = 1; i < n; i++) {
26+
for (int j = 0; j < n; j++) {
27+
if(x[i]==y[j]){
28+
c[i][j]=c[i-1][j-1]+1;
29+
b[i][j]="↖";
30+
}else if(c[i-1][j] >=c[i][j-1]){
31+
c[i][j]=c[i-1][j];
32+
b[i][j]="↑";
33+
}else{
34+
c[i][j]=c[i][j-1];
35+
b[i][j]="←";
36+
}
37+
}
38+
}
39+
list.add(b);
40+
list.add(c);
41+
return list;
42+
}
43+
public void printLCS(String[][] b,char[] x,int i,int j){
44+
if(i==0 || j==0){
45+
return;
46+
}
47+
if(b[i][j]=="↖"){
48+
printLCS(b, x, i-1, j-1);
49+
}else if(b[i][j]=="↑"){
50+
printLCS(b, x, i-1, j);
51+
}else{
52+
printLCS(b, x, i, j-1);
53+
}
54+
}
55+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package dynamicProgramming;
2+
3+
public class LongestCommonSequence {
4+
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package dynamicProgramming;
2+
3+
public class TestLongestCommonSequence {
4+
public static void main(String[] args) {
5+
LongestCommonSequence lcs=new LongestCommonSequence();
6+
char[] c1={'A','B','C','A','C','D','B'};
7+
char[] c2={'A','B','C','A','B','D','B'};
8+
}
9+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package dynamicProgramming;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
/**
6+
* 求两个序列的最长公共子序列类
7+
* @author liyafei
8+
*
9+
*/
10+
public class LongestCommonSequence {
11+
List list=new ArrayList<>();
12+
13+
/**
14+
* 求最长公共子序列的方法。
15+
* @param x 序列1
16+
* @param y 序列2
17+
* @return 返回最长公共子序列和标记
18+
*/
19+
public List LCSLength(char[] x,char[] y){
20+
int m=x.length;
21+
int n=y.length;
22+
int[][] c=new int[m][n];
23+
String[][] b=new String[m][n];
24+
25+
for (int i = 1; i < n; i++) {
26+
for (int j = 1; j < n; j++) {
27+
if(x[i]==y[j]){
28+
c[i][j]=c[i-1][j-1]+1;
29+
b[i][j]="↖";
30+
}else if(c[i-1][j] >=c[i][j-1]){
31+
c[i][j]=c[i-1][j];
32+
b[i][j]="↑";
33+
}else{
34+
c[i][j]=c[i][j-1];
35+
b[i][j]="←";
36+
}
37+
}
38+
}
39+
list.add(b);
40+
list.add(c);
41+
return list;
42+
}
43+
public void printLCS(String[][] b,char[] x,int i,int j){
44+
if(i==0 || j==0){
45+
return;
46+
}
47+
if(b[i][j]=="↖"){
48+
printLCS(b, x, i-1, j-1);
49+
}else if(b[i][j]=="↑"){
50+
printLCS(b, x, i-1, j);
51+
}else{
52+
printLCS(b, x, i, j-1);
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)