From 088001650a6d2e0c4cd6c4c6762154d94a09e114 Mon Sep 17 00:00:00 2001
From: liushurencx <736464448@qq.com>
Date: Sun, 26 Feb 2017 14:15:28 +0800
Subject: [PATCH 1/6] work01
Imitation ArrayList LinkedList Stack Queue BinaryTree
---
.../736464448/RemoteSystemsTempFiles/.project | 12 +
group06/736464448/work01/.classpath | 7 +
group06/736464448/work01/.gitignore | 1 +
group06/736464448/work01/.project | 17 ++
.../.settings/org.eclipse.jdt.core.prefs | 11 +
.../src/data_structure/MyArrayList.java | 167 ++++++++++++++
.../src/data_structure/MyBinaryTree.java | 198 +++++++++++++++++
.../src/data_structure/MyLinkedList.java | 209 ++++++++++++++++++
.../work01/src/data_structure/MyQueue.java | 21 ++
.../work01/src/data_structure/MyStack.java | 22 ++
.../test_data_structure/TestMyArrayList.java | 93 ++++++++
.../test_data_structure/TestMyBinaryTree.java | 59 +++++
.../test_data_structure/TestMyLinkedList.java | 111 ++++++++++
.../src/test_data_structure/TestMyQueue.java | 49 ++++
.../src/test_data_structure/TestMyStack.java | 60 +++++
15 files changed, 1037 insertions(+)
create mode 100644 group06/736464448/RemoteSystemsTempFiles/.project
create mode 100644 group06/736464448/work01/.classpath
create mode 100644 group06/736464448/work01/.gitignore
create mode 100644 group06/736464448/work01/.project
create mode 100644 group06/736464448/work01/.settings/org.eclipse.jdt.core.prefs
create mode 100644 group06/736464448/work01/src/data_structure/MyArrayList.java
create mode 100644 group06/736464448/work01/src/data_structure/MyBinaryTree.java
create mode 100644 group06/736464448/work01/src/data_structure/MyLinkedList.java
create mode 100644 group06/736464448/work01/src/data_structure/MyQueue.java
create mode 100644 group06/736464448/work01/src/data_structure/MyStack.java
create mode 100644 group06/736464448/work01/src/test_data_structure/TestMyArrayList.java
create mode 100644 group06/736464448/work01/src/test_data_structure/TestMyBinaryTree.java
create mode 100644 group06/736464448/work01/src/test_data_structure/TestMyLinkedList.java
create mode 100644 group06/736464448/work01/src/test_data_structure/TestMyQueue.java
create mode 100644 group06/736464448/work01/src/test_data_structure/TestMyStack.java
diff --git a/group06/736464448/RemoteSystemsTempFiles/.project b/group06/736464448/RemoteSystemsTempFiles/.project
new file mode 100644
index 0000000000..5447a64fa9
--- /dev/null
+++ b/group06/736464448/RemoteSystemsTempFiles/.project
@@ -0,0 +1,12 @@
+
+
+ RemoteSystemsTempFiles
+
+
+
+
+
+
+ org.eclipse.rse.ui.remoteSystemsTempNature
+
+
diff --git a/group06/736464448/work01/.classpath b/group06/736464448/work01/.classpath
new file mode 100644
index 0000000000..373dce4005
--- /dev/null
+++ b/group06/736464448/work01/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/group06/736464448/work01/.gitignore b/group06/736464448/work01/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/group06/736464448/work01/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/group06/736464448/work01/.project b/group06/736464448/work01/.project
new file mode 100644
index 0000000000..a703634d61
--- /dev/null
+++ b/group06/736464448/work01/.project
@@ -0,0 +1,17 @@
+
+
+ work01
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/group06/736464448/work01/.settings/org.eclipse.jdt.core.prefs b/group06/736464448/work01/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..3a21537071
--- /dev/null
+++ b/group06/736464448/work01/.settings/org.eclipse.jdt.core.prefs
@@ -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
diff --git a/group06/736464448/work01/src/data_structure/MyArrayList.java b/group06/736464448/work01/src/data_structure/MyArrayList.java
new file mode 100644
index 0000000000..eb2cd98752
--- /dev/null
+++ b/group06/736464448/work01/src/data_structure/MyArrayList.java
@@ -0,0 +1,167 @@
+package data_structure;
+
+
+import java.util.Arrays;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+
+public class MyArrayList {
+ private int modCount;
+
+ private static final Object[] EMPTY_ELEMENTDATA = {};
+ //����
+ private int capacity;
+ //ʵ������Ԫ�س���
+ private int size=0;
+ //����һ��˽�е�element����
+ private Object[] elementData;
+
+ public MyArrayList(){
+ elementData=EMPTY_ELEMENTDATA;
+ capacity=0;
+ }
+
+ public MyArrayList(int initialCapacity) {
+
+ if (initialCapacity < 0)
+ throw new IllegalArgumentException("Illegal Capacity: "+
+ initialCapacity);
+ this.elementData = new Object[initialCapacity];
+ capacity=initialCapacity;
+ }
+
+ public void add(Object o){
+
+
+ ensureCapacityInternal(size + 1);
+ elementData[size++] = o;
+
+
+ }
+
+ public void add(int index ,Object o){
+
+ rangCheck(index);
+ ensureCapacityInternal(size + 1);
+
+ System.arraycopy(elementData, index, elementData, index + 1,size - index);
+ elementData[index] =o;
+ size++;
+
+
+
+
+ }
+ public Object get(int index){
+ rangCheck(index);
+ return elementData[index];
+ }
+ public Object remove(int index){
+ modCount++;
+ rangCheck(index);
+ Object o=null;
+ o=elementData[index] ;
+ int numMoved = size - index - 1;
+ if (numMoved > 0)
+
+ System.arraycopy(elementData, index+1, elementData, index ,size - index-1);
+ elementData[--size] = null;
+
+
+ return o;
+ }
+ public int size(){
+ return size;
+
+ }
+ public int Capacity(){
+ return capacity;
+ }
+ private void rangCheck(int index){
+ if(index > size || index < 0)
+ throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
+ }
+
+ private String outOfBoundsMsg(int index) {
+ return "Index: "+index+", Size: "+size;
+ }
+
+// private class MyIndexOutOfBoundsException extends RuntimeException{
+// @SuppressWarnings("unused")
+// public MyIndexOutOfBoundsException(String e) {
+// super();
+// }
+// }
+ private void ensureCapacityInternal(int minCapacity) {
+
+ modCount++;
+ if (elementData == EMPTY_ELEMENTDATA) {
+ minCapacity = Math.max(10, minCapacity);
+ capacity=minCapacity;
+ }
+ if (minCapacity - elementData.length > 0)
+
+ grow(minCapacity);
+ }
+ private void grow(int minCapacity) {
+ // overflow-conscious code
+ int oldCapacity = elementData.length;
+ int newCapacity = oldCapacity + (oldCapacity >> 1);
+ if (newCapacity - minCapacity < 0)
+ newCapacity = minCapacity;
+ capacity=newCapacity;
+
+ elementData = Arrays.copyOf(elementData, newCapacity);
+ }
+ public Iterator