Skip to content

Commit

Permalink
Merge pull request #14 from CHENTao-U/master
Browse files Browse the repository at this point in the history
第一次作业【from 西安-秋】
  • Loading branch information
wizardzhang2017 authored Mar 12, 2017
2 parents e8a323c + a162537 commit 030ea7f
Show file tree
Hide file tree
Showing 16 changed files with 239 additions and 0 deletions.
Binary file added group27/2567012201/.DS_Store
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions group27/2567012201/2567012201learning/.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.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions group27/2567012201/2567012201learning/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions group27/2567012201/2567012201learning/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>2567012201learning</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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.coding.DataStructure;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public abstract class ArrayList implements List {

private int size = 0;
private static final int INCREMENT = 10;

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

public void add(Object o) {

if ((size + 1)>= 100) {
throw new RuntimeException("数组越界异常");
}
elementData[size] = 0;
size++;
}

public void add(int index, Object o){
growLength();
System.arraycopy(elementData, index, elementData, index+1, size-index);
elementData[index] = o;
size++;
}

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

public Object remove(int index){
if (index > size) throw new IndexOutOfBoundsException("index: "+index+", size: "+size);
Object retVal = elementData[index];
System.arraycopy(elementData, index+1, elementData, index, size-(index+1));
elementData[--size] = null;
return retVal;
}

public int size(){
return this.size;
}

public Iterator iterator(){
return null;
}
private void growLength() {
if (this.size == elementData.length) {
elementData = Arrays.copyOf(elementData, elementData.length+INCREMENT);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.coding.DataStructure;

public class LinkedList {

public void addLast(E o) {
// TODO Auto-generated method stub

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.coding.DataStructure;

import java.util.NoSuchElementException;

public class Queue {
private int size;
private LinkedList list = new LinkedList();

public void enQueue(Object o){
list.addLast(o);;
size++;
}

public Object deQueue(){
if(size<=0){
throw new NoSuchElementException();
}
Object val = list.removeFirst();
size--;
return val;
}

public boolean isEmpty(){
boolean flag = false;
if(size >= 0){
flag = true;
}
return flag;
}

public int size(){
return size;
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.coding.DataStructure;

import java.util.NoSuchElementException;

public class Stack {
private ArrayList elementData = new ArrayList();
private int size;

public void push(Object o){
elementData.add(o);
size++;
}

public Object pop(){
if(size<=0){
throw new NoSuchElementException();
}
int len = size-1;
Object val = elementData.remove(len);
size--;
return val;
}

public Object peek(){
if(size<=0){
throw new NoSuchElementException();
}
int len = size-1;
return elementData.get(len);
}
public boolean isEmpty(){
boolean flag = false;
if(size >= 0){
flag = true;
}
return flag;
}
public int size(){
return size;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.coding.DataStructure;

public class Tree {
private Object data;
private Tree left;
private Tree right;

public Object getData() {
return data;
}

public void setData(Object data) {
this.data = data;
}

public Tree getLeft() {
return left;
}

public void setLeft(Tree left) {
this.left = left;
}

public Tree getRight() {
return right;
}

public void setRight(Tree right) {
this.right = right;
}

public Tree insert(Object o) {
if (data == null) {
setData(o);
} else {
Integer i = (Integer) o;
if (i.compareTo((Integer) data) == -1) {
if(right == null)
right = new Tree();
return right.insert(i);
} else if (i.compareTo((Integer) data) == 1) {
if(left == null)
left = new Tree();
return left.insert(i);
}
return null;
}
return null;
}

}
12 changes: 12 additions & 0 deletions group27/2567012201/RemoteSystemsTempFiles/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RemoteSystemsTempFiles</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
</natures>
</projectDescription>

0 comments on commit 030ea7f

Please sign in to comment.