forked from onlyliuxin/coding2017
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from luoziyihao/master
pull request for code of homework 26 Feb
- Loading branch information
Showing
718 changed files
with
34,965 additions
and
1,313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>homework</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
2 changes: 2 additions & 0 deletions
2
group07/1536161030/.settings/org.eclipse.core.resources.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
������ڲ���Ҫ���������CPU���ڴ棬Ӳ�̣�ָ� | ||
CPU��Ҳ�д��������˿�����˼�������Կ�CPU���㡣CPU��Ҫ�������Ϳ��ƵIJ��֣�����˼�壬���ǿ��Ƶ�Ԫ�����㵥Ԫ�����֣������˵Ĵ��Խ��м��������һ���� | ||
�����Եļ����������һ��ģ����������ÿ�����ܵ�Ԫ���Ƿֹ���ȷ�ġ����п��Ƶ�Ԫ���ݳ���ͨ��ָ�����������㵥Ԫ����������ó������Ȼ����ƴ洢��Ԫ���洢�м�Ľ���� | ||
�ڴ��Ǵ洢CPU��Ҫ���������ϣ���Ҫ�����У�����ϵͳ�е���ʱ���ݣ������Ӳ�̶�ȡ�����ݣ��ṩ��CPUʹ�á� | ||
Ӳ���Ǹ���洢������Ҫ���ô洢�����ݣ��������ǵij�������ݣ��ŵ��Ƿdz��̶���������ȷ���������Դ洢����Ϣ��������ʱ��������� | ||
�ڴ��ȡ���ݵ��ٶȱ�Ӳ�̵Ĵ�ȡ�ٶȿ���10���� ��ijЩ��������ܻ���� | ||
CPU���ٶȱ��ڴ治֪Ҫ����ٱ��������ǰѳ����Ӳ�̷ŵ��ڴ��Ժ�CPU��ֱ�����ڴ����г���������CPUֱ����Ӳ�����г����Ҫ��ܶࡣ | ||
�����ڴ�����һ����CPU���й��죬��Ӳ�����ݴ�ȡ̫�������⡣ ��������ǵĵ��Ե������ٶȡ� | ||
���������г����ʱ��CPU���Ƚ��ܵ����ǵ����֮��CPU�Ǹ���Ӳ�̣���Ҫ������洢�ij���A����ѳ���A�͵��ڴ�ȥ��CPU���ڴ�˵������Ӳ�̰ѳ���A�͵����������ˣ��㱣��һ�¡� �ȳ���A���������͵��ڴ�֮��CPU�Ϳ�ʼִ�г���A����CPU������㣬���ȡ������δ洢���ݣ�������ζ������������й�ͨ�������Ҫָ���ˡ� | ||
ָ��Ҳ���ǻ������Ե�һ������䣬�൱��CPU���ڴ棬Ӳ��֮������ԡ�����ָ�Ӽ�������������������������ݵ����㣬�����㣬���ݴ��ͣ�����Ŀ��ƣ��������ָ��ȡ� | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
��װgit gui��������git bash���� | ||
1.��¡ | ||
git clone [email protected]:leijing1992/coding2017.git | ||
2.�����ĵ��ļ� | ||
git add -A | ||
3.�ύ���ݴ��� | ||
git commit -m "�ύ***����" | ||
4.����master | ||
git pull origin master | ||
5.�ύ��master | ||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.coding.basic; | ||
|
||
public class ArrayList implements List{ | ||
|
||
private int size = 0; | ||
|
||
private Object[] elementData; | ||
|
||
public ArrayList(int size) { | ||
this.elementData = new Object[size]; | ||
} | ||
|
||
public ArrayList() { | ||
this.elementData = new Object[10]; | ||
} | ||
|
||
public void add(Object o) { | ||
if(isFull()) | ||
resize(); | ||
elementData[size++] = o; | ||
} | ||
|
||
public void add(int index, Object o) { | ||
rangeCheckForAdd(index); | ||
System.arraycopy(elementData, index, elementData, index + 1, size - index); | ||
elementData[index] = o; | ||
size++; | ||
} | ||
|
||
public Object get(int index) { | ||
rangeCheckForAdd(index); | ||
return elementData[index]; | ||
} | ||
|
||
public Object remove(int index) { | ||
rangeCheckForAdd(index); | ||
Object o = elementData[index]; | ||
System.arraycopy(elementData, index + 1, elementData, index, size - index); | ||
elementData[--size] = null; | ||
return o; | ||
} | ||
|
||
public int size() { | ||
return elementData.length; | ||
} | ||
|
||
public com.coding.basic.Iterator iterator() { | ||
return new Itr(); | ||
} | ||
|
||
private class Itr implements com.coding.basic.Iterator { | ||
int cursor; | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return cursor != size; | ||
} | ||
|
||
@Override | ||
public Object next() { | ||
int i = cursor; | ||
if (i < elementData.length) { | ||
cursor = i + 1; | ||
return elementData[i]; | ||
} | ||
return null; | ||
} | ||
} | ||
|
||
//檢查下表越界 | ||
public void rangeCheckForAdd(int index) { | ||
if (index < 0 || index > size) | ||
throw new IndexOutOfBoundsException("下标越界"); | ||
} | ||
|
||
//数组是否满 | ||
public boolean isFull(){ | ||
return size == elementData.length; | ||
} | ||
|
||
//扩容 | ||
public void resize(){ | ||
Object[] newElementData = new Object[elementData.length * 2]; | ||
System.arraycopy(elementData, 0, newElementData, 0, size); | ||
this.elementData = newElementData; | ||
newElementData = null; | ||
} | ||
|
||
// | ||
public boolean isEmpty() { | ||
return size == 0; | ||
} | ||
|
||
|
||
} |
75 changes: 75 additions & 0 deletions
75
group07/1536161030/src/com/coding/basic/BinaryTreeNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.coding.basic; | ||
|
||
public class BinaryTreeNode <Object extends Comparable<Object>> { | ||
|
||
private Object data; | ||
|
||
private BinaryTreeNode left; | ||
|
||
private BinaryTreeNode right; | ||
|
||
public BinaryTreeNode(Object data){ | ||
this.data = data; | ||
this.left=null; | ||
this.right =null; | ||
} | ||
|
||
public BinaryTreeNode root; | ||
|
||
public Object getData() { | ||
return data; | ||
} | ||
|
||
public void setData(Object data) { | ||
this.data = data; | ||
} | ||
|
||
public BinaryTreeNode getLeft() { | ||
return left; | ||
} | ||
|
||
public void setLeft(BinaryTreeNode left) { | ||
this.left = left; | ||
} | ||
|
||
public BinaryTreeNode getRight() { | ||
return right; | ||
} | ||
|
||
public void setRight(BinaryTreeNode right) { | ||
this.right = right; | ||
} | ||
/* | ||
* 二叉树 b 插入对象 o 父节点 pnode | ||
* 若b为空树,插入节点作为根 | ||
* o 等于根节点 直接返回 | ||
* o 小于根节点 pnode = 左子树 | ||
* else pnode = 右子树 | ||
* | ||
*/ | ||
public BinaryTreeNode insert(Object o) { | ||
BinaryTreeNode current = root; | ||
|
||
if(current == null){ | ||
return new BinaryTreeNode(o); | ||
} | ||
if (o.compareTo((Object) current.data)<0){ | ||
if(current.left !=null){ | ||
current = current.left; | ||
}else{ | ||
current.left = new BinaryTreeNode(o); | ||
return current; | ||
} | ||
}else if(o.compareTo((Object) current.data)==0){ | ||
return current; | ||
}else{ | ||
if(current.right !=null){ | ||
current = current.right; | ||
}else{ | ||
current.right = new BinaryTreeNode(o); | ||
return current; | ||
} | ||
} | ||
return current; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.coding.basic; | ||
|
||
public interface Iterator { | ||
boolean hasNext(); | ||
|
||
Object next(); | ||
|
||
} |
Oops, something went wrong.