Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同步代码 #162

Merged
merged 42 commits into from
Apr 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
191789c
Merge pull request #2 from luoziyihao/master
williamgx8 Mar 6, 2017
4cd0036
中途提交保存
Mar 13, 2017
4849ef4
二分之一数据结构和算法
Mar 13, 2017
3c81c87
中途提交保存
Mar 14, 2017
8ca1d72
中途提交
Mar 14, 2017
c2e1644
中途提交保存
Mar 21, 2017
743e20d
addignore
zhiyuan0101 Mar 28, 2017
3ff26bc
addignore2
zhiyuan0101 Mar 28, 2017
9caa104
lru
zhiyuan0101 Mar 29, 2017
e772308
finish half
Mar 30, 2017
39e4662
finish lru
Mar 31, 2017
983e4a8
homework of 17/3/26 finished ,first jvm homework and LRU
Wrecksoul Mar 31, 2017
d9efccd
com
Mar 31, 2017
12c5a2a
add jvm homework
earlywusa Apr 2, 2017
459904f
add jvm
earlywusa Apr 2, 2017
940f6bf
add LRU
earlywusa Apr 2, 2017
c9b213b
lru classloader
zhiyuan0101 Apr 4, 2017
282b626
文章
Ren650119726 Apr 4, 2017
a6781e3
com
Apr 5, 2017
0d75444
add 20170326-20170402.md
Apr 5, 2017
bbfef7b
add 20170326-20170402.md
Apr 5, 2017
a3dfb88
Merge pull request #55 from Ren650119726/patch-2
luoziyihao Apr 5, 2017
500a408
Merge branch 'master' of https://github.com/luoziyihao/coding2017.git
zhiyuan0101 Apr 5, 2017
7e3076f
12
zhiyuan0101 Apr 5, 2017
6ee423f
Merge branch 'master' of https://github.com/luoziyihao/coding2017.git
zhiyuan0101 Apr 5, 2017
e5f94d8
article
zhiyuan0101 Apr 5, 2017
362e737
article.
zhiyuan0101 Apr 5, 2017
e75f61b
完成jvm第一次作业
Apr 5, 2017
ccf558f
Merge remote-tracking branch 'origin/master'
Apr 5, 2017
f878406
完成3月26日作业
Apr 5, 2017
ffe1628
第四周作业—-代码
240094626 Apr 6, 2017
187bb04
Merge branch 'master' of https://github.com/luoziyihao/coding2017 int…
earlywusa Apr 6, 2017
88266ef
add article link
earlywusa Apr 6, 2017
53f753c
work_jvm_1_LRU
240094626 Apr 6, 2017
0d51654
half getElements
Apr 6, 2017
1696720
home
Apr 9, 2017
e1cec01
add 20170326-20170402.md 20170402-20170409.md
Apr 9, 2017
4c26bd8
Merge pull request #58 from 240094626/master
luoziyihao Apr 9, 2017
b19ecb3
Merge pull request #57 from earlywusa/1282579502-Branch
luoziyihao Apr 9, 2017
5605adb
Merge pull request #56 from williamgx8/master
luoziyihao Apr 9, 2017
407435f
Merge pull request #53 from 12378wzy/master
luoziyihao Apr 9, 2017
9d47036
Merge pull request #51 from Wrecksoul/master
luoziyihao Apr 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,21 @@ public void removeFirstSize(int firstSize) {
* @param length
*/
public void remove(int i, int length) {
if (i == 0 ) {removeFirstSize(length); return;}
if (i >= size || length == 0) {return;}
if (i == 0) {
removeFirstSize(length);
return;
}
if (i >= size || length == 0) {
return;
}

int lastLenth = size - i;
length = length <= lastLenth? length : lastLenth;
Node pre = node(i-1);
length = length <= lastLenth ? length : lastLenth;
Node pre = node(i - 1);
int j = 0;

Node next = pre;
while (j++ < length){
while (j++ < length) {
next = next.next;
}
pre.next = next.next;
Expand All @@ -213,9 +218,44 @@ public void remove(int i, int length) {
* @param list
*/
public int[] getElements(LinkedList list) {
return null;
if (size() == 0) {
return new int[0];
}
Iterator iterator = list.iterator();
Node fromNode = iterator().nextNode();
int fromIndex = 0;

int[] retArray = new int[list.size()];
int retIndex = 0;
while (iterator.hasNext()) {
int index = (int) iterator.next();
Node node = node(fromNode, fromIndex, index);
fromIndex = index;
fromNode = node;
if (node == null) {
return retArray;
} else {
retArray[retIndex++] = (int)node.data;
}
}
return retArray;
}

private Node node(Node fromNode, int fromIndex, int index) {
Node next = fromNode;
int nextIndex = fromIndex;
while (next != null && nextIndex < index) {
next = next.next;
nextIndex++;
}
if (nextIndex == index) {
return next;
} else {
return null;
}
}


/**
* 已知链表中的元素以值递增有序排列,并以单链表作存储结构。
* 从当前链表中中删除在listB中出现的元素
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;

/**
* Created by luoziyihao on 3/23/17.
*/
Expand Down Expand Up @@ -83,9 +85,12 @@ private LinkedList createAndFillLinkedList() {
}

private LinkedList createAndFillLinkedList(int length) {
return createAndFillLinkedList(1, length);
}

private LinkedList createAndFillLinkedList(int start, int length) {
LinkedList linkedList = new LinkedList();
for (int i = 1; i <= length; i++) {
for (int i = start; i <= length; i++) {
linkedList.add(i);
}
return linkedList;
Expand Down Expand Up @@ -136,6 +141,9 @@ public void remove7() throws Exception {

@Test
public void getElements() throws Exception {
LinkedList listA= createAndFillLinkedList(0,8);
LinkedList listB = createAndFillLinkedList(4, 4);
Assert.assertEquals("[4,5,6,7]", Arrays.toString(listA.getElements(listB)));

}

Expand Down
9 changes: 9 additions & 0 deletions group17/1204187480/code/homework/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,13 @@
</plugins>
</build>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</reporting>
</project>
6 changes: 4 additions & 2 deletions group17/1264835468/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/bin/
/bin/

.classpath
.project
.gitignore
.gitignore
/.idea/
.iml
Loading