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

第六组修改后请求尝试合并 #39

Merged
merged 52 commits into from
Feb 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5f8f447
first commit
guokaide Feb 24, 2017
300feea
homework
Feb 24, 2017
07940f8
cpu , memory , hard disk, order 's common
Feb 24, 2017
45cc463
Merge pull request #1 from yanghaitao0410/master
diliuzuzhanghao Feb 24, 2017
f83d574
作业和文章
diliuzuzhanghao Feb 24, 2017
40bdce2
作业和文章
diliuzuzhanghao Feb 24, 2017
391a763
提交作业
Pxshuo163 Feb 24, 2017
c20c357
1st commit--init with ArrayList
Feb 25, 2017
f0e4040
basic test for self implemented ArrayList
Feb 25, 2017
0fbde07
update ArrayList
Feb 25, 2017
6de3613
添加单元测试
Pxshuo163 Feb 25, 2017
5f56c2a
提交文章
Pxshuo163 Feb 25, 2017
bdf63af
Merge pull request #2 from Pxshuo163/master
diliuzuzhanghao Feb 25, 2017
5671ee3
第一周作业提交
xiaozhupig Feb 25, 2017
2ba27e0
Merge branch 'diliuzuzhanghao/master'
wxyjwxyj Feb 26, 2017
1a1b183
first week homework
Feb 26, 2017
c02d852
236995728提交作业
lugaoyu Feb 26, 2017
2e89d87
236995728word文档
lugaoyu Feb 26, 2017
d7cfb7c
236995728提交作业之文档
lugaoyu Feb 26, 2017
6c10cd4
补充文章地址
xiaozhupig Feb 26, 2017
22c1f53
Merge pull request #5 from lugaoyu/master
diliuzuzhanghao Feb 26, 2017
d8299d4
Merge pull request #4 from howtosmile/master
diliuzuzhanghao Feb 26, 2017
70e3f18
Merge pull request #3 from xiaozhupig/master
diliuzuzhanghao Feb 26, 2017
0880016
work01
liushurencx Feb 26, 2017
a0a102f
Delete .project
liushurencx Feb 26, 2017
4d486d5
delete success
liushurencx Feb 26, 2017
5a0812b
Merge remote-tracking branch 'origin/master'
liushurencx Feb 26, 2017
36245f7
haha
liushurencx Feb 26, 2017
c4cbad1
This time it's right
liushurencx Feb 26, 2017
734a4c1
Do it again
liushurencx Feb 26, 2017
3e93f46
Merge pull request #7 from liushurencx/master
diliuzuzhanghao Feb 26, 2017
da509b4
1259131938第一周作业
yichen10 Feb 26, 2017
25c54ae
Merge pull request #8 from yichen10/master
diliuzuzhanghao Feb 26, 2017
ec1134d
homework:first week
guokaide Feb 26, 2017
edcd316
remove article.txt
guokaide Feb 26, 2017
5d0fd89
Merge pull request #9 from foreverkai/master
diliuzuzhanghao Feb 26, 2017
31d3abd
commit basic container
devinyeen Feb 26, 2017
147771f
第一周作业
wxyjwxyj Feb 26, 2017
d3e3ceb
Merge branch 'diliuzuzhanghao/master'
wxyjwxyj Feb 26, 2017
e12e573
coding2017 exercise: my own collection
chaoswang Feb 26, 2017
e1d1387
document week 8 for cpu/mem/hd/instruct
devinyeen Feb 26, 2017
48d8d4b
Merge pull request #11 from wxyjwxyj/master
diliuzuzhanghao Feb 26, 2017
844b474
Merge pull request #10 from devinyeen/master
diliuzuzhanghao Feb 26, 2017
9d7dc97
Merge pull request #12 from chaoswang/master
diliuzuzhanghao Feb 26, 2017
9059979
First test by ZhaiYang
RogenSH Feb 26, 2017
1a1ca79
work
CCDBG Feb 26, 2017
2f19388
Merge pull request #14 from BGPY/master
diliuzuzhanghao Feb 26, 2017
63f9d71
Merge pull request #13 from RogenSH/master
diliuzuzhanghao Feb 26, 2017
36c06df
提交作业
Feb 26, 2017
e9da53b
Merge pull request #15 from dcscodelife/master
diliuzuzhanghao Feb 27, 2017
57319cd
bobi
diliuzuzhanghao Feb 28, 2017
c1511ba
Merge remote-tracking branch 'refs/remotes/onlyliuxin/master'
diliuzuzhanghao Feb 28, 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
49 changes: 49 additions & 0 deletions group06/1049564215/src/com/coding/basic/MyArrayList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import java.util.*;

/**
* @author CCD
*
*/
public class MyArrayList {

private Object[] elementData = new Object[100];
private int size = 100 ;

public void add(Object o){
elementData[size++] = o;
}
public void add(int index, Object o){
if(index > size || index < 0)
throw new IndexOutOfBoundsException("index "+ index +"is biger than size" + size+
"index is less than 0");
System.arraycopy(elementData, index, elementData, index+1, size-index);
elementData[index] = o;
size++;
}

public Object get(int index){
if(index > size || index < 0)
throw new IndexOutOfBoundsException("index "+ index +"is biger than size" + size+
"index is less than 0");
return elementData[index];
}

public Object remove(int index){
if(index > size || index < 0)
throw new IndexOutOfBoundsException("index "+ index +"is biger than size" + size+
"index is less than 0");
Object E = elementData[index];
System.arraycopy(elementData, index+1, elementData, index,
size - index - 1);
elementData[--size] = null;
return E;
}

public int size(){
return size;
}

public Iterator iterator(){
return null;
}
}
124 changes: 124 additions & 0 deletions group06/1049564215/src/com/coding/basic/MyLinkedList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import java.util.*;

public class MyLinkedList implements List {

private Node first;
private Node last;
private int size = 0 ;
public void Myadd(Object o){
final Node l = last;
final Node newNode = new Node(l,o,null);
last = newNode;
if(l == null)
first = newNode;
else
l.next = newNode;
size++;
}
public void Myadd(int index , Object o){
checkPosition(index);
if(index == size){
Myadd(o);
}
else{
final Node PreNode =GetNodeByIndex(index).prev;
final Node newNode = new Node(PreNode,o,GetNodeByIndex(index));
PreNode.next =newNode;
if(PreNode == null)
first = newNode; //ΪʲôҪ������ָ�룿
else
PreNode.next = newNode;
size++;
}
}
public Object get(int index){
checkPosition(index);
return GetNodeByIndex(index);
}
public void remove(int index){
Node node = GetNodeByIndex(index);
node.prev.next = node.next;
node.next.prev = node.prev;
node = null;
size--;
}

public int size(){
return size;
}

public void addFirst(Object o){
final Node FirstNode= first;
final Node newNode = new Node(null,o,first);
first = newNode;
if(FirstNode == null)
last = newNode;
else
first.prev = newNode;
size++;

}
public void addLast(Object o){
final Node LastNode = last;
final Node newNode = new Node(last,o,null);
last = newNode;
if(last == null)
first = newNode;
else
last.next = newNode;
size++;
}
public void removeFirst(){
final Node f = first;
if(f == null)
throw new NoSuchElementException();
first = f.next;
first = null;
size--;
}
public void removeLast(){
final Node f = last;
if(f == null)
throw new NoSuchElementException();
last = last.prev;
last = null;
size--;
}
public Iterator iterator(){
return null;
}


private static class Node{
Object item;
Node next;
Node prev;
Node (Node prev,Object element ,Node next){
this.item = element;
this.next = next;
this.prev = prev;
}
}

private Node GetNodeByIndex(int index){
if(index > size/2)
{
Node Temp = first;
for(int i = 0; i< index;i++)
Temp = Temp.next; //
return Temp;
}
else
{
Node Temp = last;
for(int i = size-1; i> index; i--)
Temp = Temp.prev;
return Temp;
}
}

private void checkPosition(int index){
if(index < 0 || index > size)
throw new IndexOutOfBoundsException("index:"+ index+"is llegal");
}
}
52 changes: 52 additions & 0 deletions group06/1049564215/src/com/coding/basic/MyQueue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

/**
* @author CCD
*
*/

import java.util.*;

public class MyQueue {

private static final int DEFAULT_SIZE = 10;

private Object[] elementData;
private int head;
private int tail;
public MyQueue(){
this(DEFAULT_SIZE);
}
public MyQueue(int size){
this.elementData = new Object[size];
this.head = 0;
this.tail = 0;
}

public void enQueue(Object o){
if((tail+1)%elementData.length == head){
}
else{
elementData[tail] = o;
tail = (tail+1)%elementData.length;
}
}

public Object deQueue(){
if(head == tail){
return null;
}
else{
Object o = elementData[head];
head = (head+1)% elementData.length;
return o ;
}
}

public boolean isEmpty(){
return head == tail ;
}

public int size(){
return (tail-head)&(elementData.length -1);
}
}
45 changes: 45 additions & 0 deletions group06/1049564215/src/com/coding/basic/MyStack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import java.util.*;

/**
*
*/

/**
* @author CCD
*
*/
public class MyStack {

private ArrayList elementData = new ArrayList();
private Object[] Myelement = elementData.toArray();
private int Length = elementData.size();

public void push(Object E){
Myelement[++Length] = E ;
}

public Object pop(){
int NowLength = size()-1;
Object obj = peek();
Length--;
Myelement[Length] = null ;
return obj;
}

public Object peek(){
int NowLength = size();
if(NowLength == 0)
throw new EmptyStackException();
NowLength -= 1 ;
if(NowLength >= Length )
throw new ArrayIndexOutOfBoundsException(NowLength + " >= " + Length);
return Myelement[NowLength];

}
public boolean isEmpty(){
return size() == 0;
}
public int size(){
return Length;
}
}
6 changes: 6 additions & 0 deletions group06/1259131938/JavaLearning/.classpath
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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
</classpath>
File renamed without changes.
17 changes: 17 additions & 0 deletions group06/1259131938/JavaLearning/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JavaLearning</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.coding.basic;

/**
* @deprecated 用数组实现list
* @author wang
*
*/
public class MyArrayList implements List {

private int size = 0;

private Object[] elementData = new Object[100];

public void add(Object o){
// 确保数组大小
ensureCapacity(size + 1);
// 数组赋值并使得size+1;
elementData[size ++] = o;
size ++;
}

/**
* 确保数组不越界,否则就扩容;
* @param minCapacity list的大小;
*/
public void ensureCapacity(int minCapacity) {
int oldCapacity = elementData.length;
int newCapacity = (oldCapacity / 3) * 2 + 1;
if (minCapacity > newCapacity) {
// 对数组扩容
Object[] newDate = new Object[newCapacity];
System.arraycopy(elementData, 0, newDate, 0, oldCapacity);
elementData = newDate;
}
}

public void add(int index, Object o){
// 对index进行校验:
rangeCheck(index);
ensureCapacity(size + 1);
System.arraycopy(elementData, index, elementData, index + 1, size - index);
elementData[index] = o;
size ++;
}

/**
* 边界检查:
* @param index
*/
private void rangeCheck(int index) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException("size" + size + ", index:"
+ index);
}
}

public Object get(int index){
rangeCheck(index);
return elementData[index];
}

public Object remove(int index){
rangeCheck(index);
Object oldValue = elementData[index];
System.arraycopy(elementData, index, elementData, index - 1, size - index);
return oldValue;
}

public int size(){
return size;
}

public Iterator iterator(){
return null;
}

}
Loading