Skip to content

Commit 4f889f6

Browse files
committed
fix
1 parent cf84220 commit 4f889f6

Some content is hidden

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

68 files changed

+2343
-0
lines changed

N-Queen/.classpath

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="lib" path="lib/jfreechart-1.0.19/jfreechart-1.0.19-demo.jar"/>
6+
<classpathentry kind="lib" path="lib"/>
7+
<classpathentry kind="lib" path="miglayout15-swing.jar" sourcepath="miglayout-src.zip"/>
8+
<classpathentry kind="output" path="bin"/>
9+
</classpath>

N-Queen/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>N-Queen</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

Project/.classpath

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="lib" path="miglayout15-swing.jar" sourcepath="miglayout-src.zip"/>
6+
<classpathentry kind="lib" path="C:/Users/Administrator/Desktop/jfreechart-1.0.19/jfreechart-1.0.19-demo.jar"/>
7+
<classpathentry kind="output" path="bin"/>
8+
</classpath>

Project/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Project</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8

Project/bin/Function.class

3.34 KB
Binary file not shown.

Project/bin/Gui$1.class

741 Bytes
Binary file not shown.

Project/bin/Gui$10.class

599 Bytes
Binary file not shown.

Project/bin/Gui$11.class

1.88 KB
Binary file not shown.

Project/bin/Gui$2.class

1.55 KB
Binary file not shown.

Project/bin/Gui$3.class

1.36 KB
Binary file not shown.

Project/bin/Gui$4.class

1.39 KB
Binary file not shown.

Project/bin/Gui$5.class

1.5 KB
Binary file not shown.

Project/bin/Gui$6.class

1.01 KB
Binary file not shown.

Project/bin/Gui$7.class

1.01 KB
Binary file not shown.

Project/bin/Gui$8.class

1.01 KB
Binary file not shown.

Project/bin/Gui$9.class

597 Bytes
Binary file not shown.

Project/bin/Gui.class

21.3 KB
Binary file not shown.

Project/bin/LineChartDemo2$1.class

1.07 KB
Binary file not shown.

Project/bin/LineChartDemo2.class

4.51 KB
Binary file not shown.

Project/bin/Resources/combination.png

1.62 KB
Loading

Project/bin/Resources/diagram (2).png

760 Bytes
Loading

Project/bin/Resources/diagram.png

494 Bytes
Loading
2 KB
Loading
4.41 KB
Loading

Project/bin/Resources/efficiency.png

1.38 KB
Loading

Project/bin/Resources/growth (2).png

1.09 KB
Loading

Project/bin/Resources/growth (3).png

2.07 KB
Loading

Project/bin/Resources/growth.png

882 Bytes
Loading
1.35 KB
Loading

Project/bin/Resources/maintenance.png

1.28 KB
Loading

Project/bin/Resources/search (1).png

1.03 KB
Loading

Project/bin/Resources/search (2).png

1.34 KB
Loading

Project/bin/RoundButton.class

1.94 KB
Binary file not shown.

Project/bin/RoundJTextField.class

1.42 KB
Binary file not shown.

Project/miglayout-src.zip

181 KB
Binary file not shown.

Project/miglayout15-swing.jar

83.6 KB
Binary file not shown.

Project/src/Function.java

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import java.util.ArrayList;
2+
import java.util.Collections;
3+
import java.util.HashSet;
4+
import java.util.Random;
5+
6+
public class Function {
7+
8+
public static ArrayList<Integer> arrList1 = new ArrayList<Integer>();
9+
public static ArrayList<Integer> arrList2 = new ArrayList<Integer>();
10+
public static ArrayList<Long> timeUnion = new ArrayList<Long>();
11+
public static ArrayList<Long> timeIntersection = new ArrayList<Long>();
12+
13+
// intersection.
14+
public static ArrayList<Integer> intersection(ArrayList<Integer> a, ArrayList<Integer> b, boolean sort) {
15+
long start = System.nanoTime();
16+
17+
ArrayList<Integer> ans = new ArrayList<Integer>();
18+
HashSet<Integer> temp = new HashSet<Integer>();
19+
20+
for (Integer t : a) {
21+
if (b.contains(t)) {
22+
temp.add(t);
23+
}
24+
}
25+
26+
ans.addAll(temp);
27+
28+
long end = System.nanoTime();
29+
timeIntersection.add(end - start);
30+
31+
if (sort) {
32+
Collections.sort(ans);
33+
return ans;
34+
} else {
35+
return ans;
36+
}
37+
}
38+
39+
// making random integer in an array list.
40+
public static ArrayList<Integer> ranArrL(int length, int maxNum) {
41+
ArrayList<Integer> arrayRandom = new ArrayList<Integer>();
42+
43+
try {
44+
Random rand = new Random();
45+
rand.setSeed(System.nanoTime());
46+
47+
for (int i = 0; i < length; i++) {
48+
Integer r = rand.nextInt((maxNum + 1));
49+
arrayRandom.add(r);
50+
}
51+
52+
} catch (Exception e) {
53+
}
54+
55+
return arrayRandom;
56+
}
57+
58+
public static void timeComplexity() {
59+
timeUnion.clear();
60+
timeIntersection.clear();
61+
62+
arrList1.clear();
63+
arrList2.clear();
64+
for (int i = 0; i < Gui.getSlider_2().getValue(); i++) {
65+
arrList1.addAll(ranArrL(Gui.getSlider().getValue(), Gui.getSlider_1().getValue()));
66+
arrList2.addAll(ranArrL(Gui.getSlider().getValue(), Gui.getSlider_1().getValue()));
67+
68+
union(arrList1, arrList2, Gui.getChckbxSort().isSelected());
69+
intersection(arrList1, arrList2, Gui.getChckbxSort().isSelected());
70+
71+
arrList1.clear();
72+
arrList2.clear();
73+
}
74+
}
75+
76+
// union.
77+
public static ArrayList<Integer> union(ArrayList<Integer> a, ArrayList<Integer> b, boolean sort) {
78+
long start = System.nanoTime();
79+
80+
ArrayList<Integer> ans = new ArrayList<Integer>();
81+
HashSet<Integer> temp = new HashSet<Integer>();
82+
83+
temp.addAll(a);
84+
temp.addAll(b);
85+
86+
ans.addAll(temp);
87+
88+
long end = System.nanoTime();
89+
timeUnion.add(end - start);
90+
91+
if (sort) {
92+
Collections.sort(ans);
93+
return ans;
94+
} else {
95+
return ans;
96+
}
97+
}
98+
99+
// public static void main(String[] args) {
100+
// arrList1.addAll(ranArrL(Gui.getSlider().getValue(),
101+
// Gui.getSlider_1().getValue()));
102+
// arrList2.addAll(ranArrL(Gui.getSlider().getValue(),
103+
// Gui.getSlider_1().getValue()));
104+
//
105+
// System.out.println(arrList1 + "\n" + arrList2 + "\n" + union(arrList1,
106+
// arrList2, true));
107+
// }
108+
109+
}

0 commit comments

Comments
 (0)