Skip to content

Commit 71d23c1

Browse files
authored
Merge pull request onlyliuxin#234 from nusubmarine01/master
共2人完成
2 parents dec274e + a546e38 commit 71d23c1

File tree

47 files changed

+2457
-2
lines changed

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

+2457
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hirisun.cm</groupId>
6+
<artifactId>mini-jvm-0330</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>mini-jvm-0330</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.10</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.commons</groupId>
26+
<artifactId>commons-lang3</artifactId>
27+
<version>3.4</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>commons-io</groupId>
31+
<artifactId>commons-io</artifactId>
32+
<version>2.5</version>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
</project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hirisun.cm</groupId>
6+
<artifactId>mini-jvm-0405</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>mini-jvm-0405</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.10</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.commons</groupId>
26+
<artifactId>commons-lang3</artifactId>
27+
<version>3.4</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>commons-io</groupId>
31+
<artifactId>commons-io</artifactId>
32+
<version>2.5</version>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
</project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hirisun.cm</groupId>
6+
<artifactId>mini-jvm-0409</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>mini-jvm-0409</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.10</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.commons</groupId>
26+
<artifactId>commons-lang3</artifactId>
27+
<version>3.4</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>commons-io</groupId>
31+
<artifactId>commons-io</artifactId>
32+
<version>2.5</version>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
</project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hirisun.cm</groupId>
6+
<artifactId>mini-jvm-0416</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>mini-jvm-0416</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.10</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.commons</groupId>
26+
<artifactId>commons-lang3</artifactId>
27+
<version>3.4</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>commons-io</groupId>
31+
<artifactId>commons-io</artifactId>
32+
<version>2.5</version>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
</project>

group03/345943980/mini-jvm-0416/src/main/java/com/coding/basic/stack/expr/InfixToPostfix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.Stack;
66

77
/**
8-
* 中序表达式转后缀表达式
8+
* 中缀表达式转后缀表达式
99
* @author chenming E-mail:cm_20094020@163.com
1010
* @version 创建时间:2017年5月7日 下午4:29:06
1111
*/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hirisun.cm</groupId>
6+
<artifactId>mini-jvm-0423</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>mini-jvm-0423</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.10</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.commons</groupId>
26+
<artifactId>commons-lang3</artifactId>
27+
<version>3.4</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>commons-io</groupId>
31+
<artifactId>commons-io</artifactId>
32+
<version>2.5</version>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
</project>

group03/345943980/mini-jvm-0423/src/main/java/com/coding/basic/queue/CircleQueue.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package com.coding.basic.queue;
22

3+
/**
4+
* 实现循环队列
5+
* @author chenming E-mail:cm_20094020@163.com
6+
* @version 创建时间:2017年5月8日 下午9:59:09
7+
* @param <E>
8+
*/
39
public class CircleQueue<E> {
410

511
// 用数组来保存循环队列的元素

group03/345943980/mini-jvm-0423/src/main/java/com/coding/basic/queue/Josephus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @author chenming E-mail:cm_20094020@163.com
99
* @version 创建时间:2017年5月7日 下午10:16:22
1010
*
11-
* 用Queue来实现Josephus问题
11+
* 用Queue来实现Josephus问题(约瑟夫环)
1212
* 在这个古老的问题当中, N个深陷绝境的人一致同意用这种方式减少生存人数:
1313
* N个人围成一圈(位置记为0到N-1),并且从第一个人报数, 报到M的人会被杀死, 直到最后一个人留下来
1414
*/

group03/345943980/mini-jvm-0423/src/main/java/com/coding/basic/queue/QueueWithTwoStacks.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
import java.util.NoSuchElementException;
44
import java.util.Stack;
55

6+
/**
7+
* 用两个栈实现队列
8+
*
9+
* @author chenming E-mail:cm_20094020@163.com
10+
* @version 创建时间:2017年5月8日 下午9:59:34
11+
* @param <E>
12+
*/
613
public class QueueWithTwoStacks<E> {
714

815
private Stack<E> stack1;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hirisun.cm</groupId>
6+
<artifactId>mini-jvm-0430</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>mini-jvm-0430</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>4.10</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.commons</groupId>
26+
<artifactId>commons-lang3</artifactId>
27+
<version>3.4</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>commons-io</groupId>
31+
<artifactId>commons-io</artifactId>
32+
<version>2.5</version>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.8</source>
42+
<target>1.8</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
</project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.coding.basic.stack;
2+
3+
import java.util.Stack;
4+
5+
/**
6+
* 设计一个栈,支持栈的push和pop操作,以及第三种操作findMin, 它返回改数据结构中的最小元素
7+
* finMin操作最坏的情形下时间复杂度应该是O(1) , 简单来讲,操作一次就可以得到最小值
8+
*
9+
* @author chenming E-mail:cm_20094020@163.com
10+
* @version 创建时间:2017年5月8日 下午9:54:50
11+
*/
12+
public class QuickMinStack {
13+
14+
15+
private Stack<Integer> normalStack = new Stack<Integer>();
16+
private Stack<Integer> minNumStack = new Stack<Integer>();
17+
18+
19+
public void push(int data){
20+
normalStack.push(data);
21+
22+
if (minNumStack.isEmpty()) {
23+
minNumStack.push(data);
24+
} else {
25+
if (minNumStack.peek() >= data) {
26+
minNumStack.push(data);
27+
}
28+
}
29+
}
30+
31+
public int pop(){
32+
if (normalStack.isEmpty()) {
33+
throw new RuntimeException("the stack is empty");
34+
}
35+
int value = normalStack.pop();
36+
if (value == minNumStack.peek()) {
37+
minNumStack.pop();
38+
}
39+
return value;
40+
}
41+
42+
43+
public int findMin(){
44+
45+
if (minNumStack.isEmpty()) {
46+
throw new RuntimeException("the stack is empty");
47+
}
48+
return minNumStack.peek();
49+
}
50+
}

0 commit comments

Comments
 (0)