diff --git a/.gitignore b/.gitignore
index 8b13789179..a4f6f3d915 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,303 @@
-
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+*.pubxml
+*.publishproj
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+#############
+## Windows detritus
+#############
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac crap
+.DS_Store
+
+
+#############
+## Python
+#############
+
+*.py[cod]
+
+# Packages
+*.egg
+*.egg-info
+dist/
+build/
+eggs/
+parts/
+var/
+sdist/
+develop-eggs/
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+#ide config
+.metadata
+.recommenders
+
+*.iml
+.idea
+*.iml
+rebel.xml
+rebel-remote.xml
+
+.classpath
+.project
+.setting
+.metadata
+
+target
+#*.class
+
+log
+*.log
+tmp
+*.tmp
+
+.metadata
+RemoteSystemsTempFiles
+
+build/
+.idea/
+.gradle/
+*.class
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+#ide config
+.metadata
+.recommenders
+.idea/
+*.iml
+rebel.*
+.rebel.*
+
+target
+*.DS_Store
+liuxin/.DS_Store
+liuxin/src/.DS_Store
+
+students/1005475328/*
+students/1329920463/*
+students/1452302762/*
+students/14703250/*
+students/2842295913/*
+students/383117348/*
+students/404481481/*
+students/406400373/*
+students/549739951/*
+students/582161208/*
+students/592146505/*
+students/844620174/*
+students/87049319/*
+students/183549495/*
+
+
+
+
+
+
+
diff --git a/.project b/.project
deleted file mode 100644
index 6b4d50ed9a..0000000000
--- a/.project
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- coding2017
-
-
-
-
-
-
-
-
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 4824b80263..0000000000
--- a/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding/=UTF-8
diff --git a/group01/1298552064/src/week01/basic/Iterator.java b/group01/1298552064/src/week01/basic/Iterator.java
deleted file mode 100644
index e209875b54..0000000000
--- a/group01/1298552064/src/week01/basic/Iterator.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package week01.basic;
-
-public interface Iterator {
- public boolean hasNext();
-
- public Object next();
-
-}
diff --git a/group01/1298552064/src/week01/basic/List.java b/group01/1298552064/src/week01/basic/List.java
deleted file mode 100644
index 608c1b532b..0000000000
--- a/group01/1298552064/src/week01/basic/List.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package week01.basic;
-
-public interface List {
- public void add(Object o);
-
- public void add(int index, Object o);
-
- public Object get(int index);
-
- public Object remove(int index);
-
- public int size();
-}
diff --git a/group01/1298552064/src/week01/basic/MyArrayList.java b/group01/1298552064/src/week01/basic/MyArrayList.java
deleted file mode 100644
index c4f6572f1c..0000000000
--- a/group01/1298552064/src/week01/basic/MyArrayList.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package week01.basic;
-
-import java.util.Arrays;
-
-public class MyArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o) {
- ensureCapacity(size + 1);
-
- elementData[size++] = o;
- }
-
- public void add(int index, Object o) {
- checkPositionIndex(index);
- ensureCapacity(size + 1);
-
- if (index >= size) {
- elementData[size++] = o;
- } else {
- System.arraycopy(elementData, index, elementData, index + 1, size
- - index);
-
- elementData[index] = o;
-
- size++;
- }
- }
-
- public Object get(int index) {
- checkElementIndex(index);
- return elementData[index];
- }
-
- public Object remove(int index) {
- checkElementIndex(index);
- Object removeElement = elementData[index];
- if (index == (size - 1)) {
- elementData[index] = null;
- size--;
- } else {
- System.arraycopy(elementData, index + 1, elementData, index, size
- - index - 1);
- elementData[size - 1] = null;
- size--;
- }
- return removeElement;
- }
-
- public int size() {
- return size;
- }
-
- /**
- * 保证数组空间充足
- *
- * @param minCapacity
- */
- private void ensureCapacity(int minCapacity) {
- int capacity = elementData.length;
- if (minCapacity > capacity) {
- capacity += capacity / 2;
- grow(capacity);
- }
- }
-
- private void checkElementIndex(int index) {
- if (!isElementIndex(index)) {
- throw new IndexOutOfBoundsException("Index: " + index + ", Size: "
- + size);
- }
- }
-
- private boolean isElementIndex(int index) {
- return index >= 0 && index < size;
- }
-
- private void checkPositionIndex(int index) {
- if (!isPositionIndex(index)) {
- throw new IndexOutOfBoundsException("Index: " + index + ", Size: "
- + size);
- }
- }
-
- private boolean isPositionIndex(int index) {
- return index >= 0 && index <= size;
- }
-
- private void grow(int newCapacity) {
- elementData = Arrays.copyOf(elementData, newCapacity);
- }
-
- public Iterator iterator() {
- return new ArrayListIterator(this);
- }
-
- private class ArrayListIterator implements Iterator {
- private MyArrayList list;
- private int position = 0;
-
- private ArrayListIterator(MyArrayList list) {
- this.list = list;
- }
-
- @Override
- public boolean hasNext() {
- if ((position + 1) > size) {
- return false;
- }
- return true;
- }
-
- @Override
- public Object next() {
- return list.get(position++);
- }
- }
-
- @Override
- public String toString() {
- String elementStr = "";
- for (int i = 0; i < size; i++) {
- elementStr += elementData[i] + ",";
- }
- return "MyArrayList: { size=" + size + ", elementData=" + "["
- + elementStr.substring(0, elementStr.length() - 1) + "]" + " }";
- }
-}
diff --git a/group01/1298552064/src/week01/basic/MyBinaryTreeNode.java b/group01/1298552064/src/week01/basic/MyBinaryTreeNode.java
deleted file mode 100644
index 30e6c810a5..0000000000
--- a/group01/1298552064/src/week01/basic/MyBinaryTreeNode.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package week01.basic;
-
-public class MyBinaryTreeNode {
-
- private Object data;
- private MyBinaryTreeNode left;
- private MyBinaryTreeNode right;
-
- public Object getData() {
- return data;
- }
-
- public void setData(Object data) {
- this.data = data;
- }
-
- public MyBinaryTreeNode getLeft() {
- return left;
- }
-
- public void setLeft(MyBinaryTreeNode left) {
- this.left = left;
- }
-
- public MyBinaryTreeNode getRight() {
- return right;
- }
-
- public void setRight(MyBinaryTreeNode right) {
- this.right = right;
- }
-
- public MyBinaryTreeNode insert(Object o) {
- if(this.getData() == null && this.getLeft() == null && this.getRight() == null){
- this.setData(o);
- this.setLeft(null);
- this.setRight(null);
- return this;
- }
-
- MyBinaryTreeNode node = new MyBinaryTreeNode();
- MyBinaryTreeNode currentNode = this;
- while(true){
- if((Integer) o < (Integer) getData()){
- if(currentNode.getLeft() == null){
- node.setData(o);
- node.setLeft(null);
- node.setRight(null);
-
- currentNode.setLeft(node);
- return this;
- }else{
- currentNode = currentNode.getLeft();
- }
-
- }else{
- if(currentNode.getRight() == null){
- node.setData(o);
- node.setLeft(null);
- node.setRight(null);
-
- currentNode.setRight(node);
- return this;
- }else{
- currentNode = currentNode.getRight();
- }
- }
- }
- }
-}
diff --git a/group01/1298552064/src/week01/basic/MyLinkedList.java b/group01/1298552064/src/week01/basic/MyLinkedList.java
deleted file mode 100644
index 4894c5ff6c..0000000000
--- a/group01/1298552064/src/week01/basic/MyLinkedList.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package week01.basic;
-
-public class MyLinkedList implements List {
-
- private Node head;
- private int size;
-
- public void add(Object o) {
- // 空链表
- if (head == null) {
- head = new Node();
- head.data = o;
- head.next = null;
- } else {
- Node p = head;
- while (p.next != null) {
- p = p.next;
- }
-
- Node target = new Node();
- target.data = o;
- target.next = null;
- p.next = target;
- }
- size++;
- }
-
- public void add(int index, Object o) {
- // index 是否合法
- checkPositionIndex(index);
- if (head == null) {
- head = new Node();
- head.data = o;
- head.next = null;
- } else {
- if (index == 0) {
- addFirst(o);
- } else if (index == size) {
- addLast(o);
- } else {
- Node p = new Node();
- Node p1 = head;
- for (int i = 0; i < index - 1; i++) {
- p1 = p1.next;
- }
- p.data = o;
- p.next = p1.next;
- p1.next = p;
-
- size++;
- }
- }
- }
-
- public Object get(int index) {
- checkElementIndex(index);
- Node p = head;
- for (int i = 0; i < index; i++) {
- p = p.next;
- }
- return p.data;
- }
-
- public Object remove(int index) {
- checkElementRemove();
- checkElementIndex(index);
-
- Object removeObject = null;
- if (index == 0) {
- removeObject = removeFirst();
- } else if (index == (size - 1)) {
- removeObject = removeLast();
- } else {
- Node p = head;
- for (int i = 1; i < index; i++) {
- p = p.next;
- }
- removeObject = p.next.data;
- p.next = p.next.next;
- size--;
- }
- return removeObject;
- }
-
- public int size() {
- return size;
- }
-
- public void addFirst(Object o) {
- if (head == null) {
- head = new Node();
- head.data = o;
- head.next = null;
- } else {
- Node p = new Node();
- p.data = o;
- p.next = head;
- head = p;
- }
- size++;
- }
-
- public void addLast(Object o) {
- add(o);
- }
-
- public Object removeFirst() {
- checkElementRemove();
- Object removeObject = head.data;
- head = head.next;
- size--;
- return removeObject;
- }
-
- public Object removeLast() {
- checkElementRemove();
-
- Object removeObject = null;
-
- if (size == 1) {
- removeObject = head.data;
- head = head.next;
- } else {
- Node p = head;
- for (int i = 0; i < size; i++) {
- if (p.next.next == null) {
- removeObject = p.next;
- p.next = null;
- break;
- } else {
- p = p.next;
- }
- }
- }
- size--;
- return removeObject;
- }
-
- private boolean isEmpty() {
- return size == 0;
- }
-
- private void checkElementRemove() {
- if (isEmpty()) {
- throw new NullPointerException("The list is empty.");
- }
- }
-
- private void checkElementIndex(int index) {
- if (!isElementIndex(index)) {
- throw new IndexOutOfBoundsException("Index: " + index + ", Size: "
- + size);
- }
- }
-
- private boolean isElementIndex(int index) {
- return index >= 0 && index < size;
- }
-
- private void checkPositionIndex(int index) {
- if (!isPositionIndex(index)) {
- throw new IndexOutOfBoundsException("Index: " + index + ", Size: "
- + size);
- }
- }
-
- private boolean isPositionIndex(int index) {
- return index >= 0 && index <= size;
- }
-
- public Iterator iterator() {
- return new MyLinkedListIterator(this);
- }
-
- private class MyLinkedListIterator implements Iterator {
- private MyLinkedList list = null;
- private int position = 0;
-
- private MyLinkedListIterator(MyLinkedList list) {
- this.list = list;
- }
-
- @Override
- public boolean hasNext() {
- if ((position + 1) > size()) {
- return false;
- }
- return true;
- }
-
- @Override
- public Object next() {
- return list.get(position++);
- }
- }
-
- private static class Node {
- Object data;
- Node next;
- }
-
- @Override
- public String toString() {
- String elementStr = "";
- Node p = head;
- while (p != null) {
- elementStr += p.data + ",";
- p = p.next;
- }
-
- return "MyLinkedList: { size=" + size + ", elementData=" + "["
- + elementStr.substring(0, elementStr.length() - 1) + "]" + " }";
- }
-
-}
diff --git a/group01/1298552064/src/week01/basic/MyQueue.java b/group01/1298552064/src/week01/basic/MyQueue.java
deleted file mode 100644
index 54008652ff..0000000000
--- a/group01/1298552064/src/week01/basic/MyQueue.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package week01.basic;
-
-public class MyQueue {
-
- private MyLinkedList elementData = new MyLinkedList();
-
- public void enQueue(Object o) {
- elementData.add(o);
- }
-
- public Object deQueue() {
- return elementData.removeFirst();
- }
-
- public boolean isEmpty() {
- return elementData.size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-}
diff --git a/group01/1298552064/src/week01/basic/MyStack.java b/group01/1298552064/src/week01/basic/MyStack.java
deleted file mode 100644
index aea4d94e24..0000000000
--- a/group01/1298552064/src/week01/basic/MyStack.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package week01.basic;
-
-public class MyStack {
- private MyArrayList elementData = new MyArrayList();
-
- public void push(Object o) {
- elementData.add(o);
- }
-
- public Object pop() {
- return elementData.remove(size() - 1);
- }
-
- public Object peek() {
- return elementData.get(size() - 1);
- }
-
- public boolean isEmpty() {
- return elementData.size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-}
diff --git a/group01/1298552064/src/week01/test/MyArrayListTest.java b/group01/1298552064/src/week01/test/MyArrayListTest.java
deleted file mode 100644
index 219035b46f..0000000000
--- a/group01/1298552064/src/week01/test/MyArrayListTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package week01.test;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.basic.MyArrayList;
-
-
-
-public class MyArrayListTest {
-
- private MyArrayList list = null;
-
- @Before
- public void setUp() throws Exception {
- list = new MyArrayList();
-
- list.add(1);
- list.add(2);
- list.add(3);
- list.add(4);
- list.add(5);
- }
-
- @After
- public void tearDown() throws Exception {
- list = null;
- }
-
- @Test
- public void testAdd(){
- list.add(4, 10);
- Assert.assertEquals("MyArrayList: { size=6, elementData=[1,2,3,4,10,5] }", list.toString());
- }
-
- @Test
- public void testGet(){
- Assert.assertEquals((Object)new Integer(3), list.get(2));
- }
-
- @Test
- public void testRemove(){
- list.remove(2);
- Assert.assertEquals("MyArrayList: { size=4, elementData=[1,2,4,5] }", list.toString());
- }
-
- @Test
- public void testSize(){
- Assert.assertEquals((Object)new Integer(5), list.size());
- }
-}
diff --git a/group01/1298552064/src/week01/test/MyLinkedListTest.java b/group01/1298552064/src/week01/test/MyLinkedListTest.java
deleted file mode 100644
index b5d6c048d6..0000000000
--- a/group01/1298552064/src/week01/test/MyLinkedListTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package week01.test;
-
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.basic.MyLinkedList;
-
-public class MyLinkedListTest {
-
- private MyLinkedList list = null;
-
- @Before
- public void setUp() throws Exception {
- list = new MyLinkedList();
-
- list.add(1);
- list.add(2);
- list.add(3);
- list.add(4);
- list.add(5);
- }
-
- @After
- public void tearDown() throws Exception {
- list = null;
- }
-
-
- @Test
- public void testAdd(){
- list.add(3,10);
- Assert.assertEquals("MyLinkedList: { size=6, elementData=[1,2,3,10,4,5] }",list.toString());
- }
-
- @Test
- public void testAddFirst(){
- list.addFirst(100);
- Assert.assertEquals("MyLinkedList: { size=6, elementData=[100,1,2,3,4,5] }",list.toString());
- }
-
- @Test
- public void testAddLast(){
- list.addLast(100);
- Assert.assertEquals("MyLinkedList: { size=6, elementData=[1,2,3,4,5,100] }",list.toString());
- }
-
- @Test
- public void testGet(){
- Assert.assertEquals((Object)new Integer(5), list.get(4));
- }
-
- @Test
- public void testRemove(){
- list.remove(3);
- Assert.assertEquals("MyLinkedList: { size=4, elementData=[1,2,3,5] }",list.toString());
- }
-
- @Test
- public void testRemoveFirst(){
- list.removeFirst();
- Assert.assertEquals("MyLinkedList: { size=4, elementData=[2,3,4,5] }",list.toString());
- }
-
- @Test
- public void testRemoveLast(){
- list.removeLast();
- Assert.assertEquals("MyLinkedList: { size=4, elementData=[1,2,3,4] }",list.toString());
- }
-
- @Test
- public void testSize(){
- Assert.assertEquals((Object)new Integer(5), list.size());
- }
-
-}
diff --git a/group01/1298552064/src/week01/test/MyQueueTest.java b/group01/1298552064/src/week01/test/MyQueueTest.java
deleted file mode 100644
index f9b7cb63f2..0000000000
--- a/group01/1298552064/src/week01/test/MyQueueTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package week01.test;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.basic.MyQueue;
-
-public class MyQueueTest {
-
- private MyQueue queue = null;
-
- @Before
- public void setUp() throws Exception {
- queue = new MyQueue();
-
- queue.enQueue(1);
- queue.enQueue(2);
- queue.enQueue(3);
- }
-
- @After
- public void tearDown() throws Exception {
- queue = null;
- }
-
- @Test
- public void testEnQueue(){
- queue.enQueue(4);
- Assert.assertEquals((Object)new Integer(4), queue.size());
- }
-
- @Test
- public void testDeQueue(){
- Assert.assertEquals((Object) new Integer(1), queue.deQueue());
- }
-
- @Test
- public void testIsEmpty(){
- Assert.assertFalse(queue.isEmpty());
- }
-
- @Test
- public void testSize(){
- Assert.assertEquals((Object)new Integer(3), queue.size());
- }
-}
diff --git a/group01/1298552064/src/week01/test/MyStackTest.java b/group01/1298552064/src/week01/test/MyStackTest.java
deleted file mode 100644
index 4efbc2b204..0000000000
--- a/group01/1298552064/src/week01/test/MyStackTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package week01.test;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.basic.MyStack;
-
-public class MyStackTest {
- private MyStack stack = null;
-
- @Before
- public void setUp() throws Exception {
- stack = new MyStack();
-
- stack.push(1);
- stack.push(2);
- stack.push(3);
- }
-
- @After
- public void tearDown() throws Exception {
- stack = null;
- }
-
- @Test
- public void tearPush() throws Exception {
- stack.push(10);
- Assert.assertEquals((Object) new Integer(4), stack.size());
- Assert.assertEquals((Object) new Integer(10), stack.peek());
- }
-
- @Test
- public void testPop(){
- Assert.assertEquals((Object) new Integer(3), stack.pop());
- Assert.assertEquals((Object) new Integer(2), stack.size());
- }
-
- @Test
- public void testPeek(){
- Assert.assertEquals((Object) new Integer(3), stack.peek());
- }
-
- @Test
- public void testIsEmpty(){
- Assert.assertFalse(stack.isEmpty());
- }
-
- @Test
- public void testSize(){
- Assert.assertEquals((Object) new Integer(3), stack.size());
- }
-}
diff --git a/group01/1328404806/RemoteSystemsTempFiles/.project b/group01/1328404806/RemoteSystemsTempFiles/.project
deleted file mode 100644
index 7675629320..0000000000
--- a/group01/1328404806/RemoteSystemsTempFiles/.project
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- RemoteSystemsTempFiles
-
-
-
-
-
-
- org.eclipse.rse.ui.remoteSystemsTempNature
-
-
diff --git a/group01/1328404806/dataStructure/.classpath b/group01/1328404806/dataStructure/.classpath
deleted file mode 100644
index 7faf63dc05..0000000000
--- a/group01/1328404806/dataStructure/.classpath
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/group01/1328404806/dataStructure/.gitignore b/group01/1328404806/dataStructure/.gitignore
deleted file mode 100644
index b83d22266a..0000000000
--- a/group01/1328404806/dataStructure/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/
diff --git a/group01/1328404806/dataStructure/.project b/group01/1328404806/dataStructure/.project
deleted file mode 100644
index 86bf42de91..0000000000
--- a/group01/1328404806/dataStructure/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- dataStructure
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.m2e.core.maven2Nature
-
-
diff --git a/group01/1328404806/dataStructure/.settings/org.eclipse.core.resources.prefs b/group01/1328404806/dataStructure/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 4c28b1a898..0000000000
--- a/group01/1328404806/dataStructure/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/test/java=UTF-8
-encoding/=UTF-8
diff --git a/group01/1328404806/dataStructure/.settings/org.eclipse.jdt.core.prefs b/group01/1328404806/dataStructure/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8626026241..0000000000
--- a/group01/1328404806/dataStructure/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/group01/1328404806/dataStructure/.settings/org.eclipse.m2e.core.prefs b/group01/1328404806/dataStructure/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index 14b697b7bb..0000000000
--- a/group01/1328404806/dataStructure/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/group01/1328404806/dataStructure/pom.xml b/group01/1328404806/dataStructure/pom.xml
deleted file mode 100644
index 0b5e3a1ca3..0000000000
--- a/group01/1328404806/dataStructure/pom.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
- 4.0.0
-
- increaseLearning
- dataStructure
- 0.0.1-SNAPSHOT
- jar
-
- dataStructure
- http://maven.apache.org
-
-
- UTF-8
-
-
-
-
- junit
- junit
- 3.8.1
- test
-
-
-
diff --git a/group01/1328404806/dataStructure/src/main/java/ListService/KILinkedList.java b/group01/1328404806/dataStructure/src/main/java/ListService/KILinkedList.java
deleted file mode 100644
index 8f0307f340..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListService/KILinkedList.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package ListService;
-
-//集合接口
-public interface KILinkedList {
-
- public void add(T t, int pos);
-
- public T remove(int pos);
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListService/KIList.java b/group01/1328404806/dataStructure/src/main/java/ListService/KIList.java
deleted file mode 100644
index b0851d30b0..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListService/KIList.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package ListService;
-
-//集合接口
-public interface KIList {
-
- public void add(T item);
-
- public void add(int index, T item);
-
- public void set(int index, T item);
-
- public void remove(int index);
-
- public void remove(T item);
-
- public void clear();
-
- public boolean contains(T item);
-
- public boolean isEmpty();
-
- public T get(int index);
-
- public int indexOf(T item);
-
- public int size();
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListService/KIQueueList.java b/group01/1328404806/dataStructure/src/main/java/ListService/KIQueueList.java
deleted file mode 100644
index b02c0e86a5..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListService/KIQueueList.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package ListService;
-
-//集合接口
-public interface KIQueueList {
- public T add(T ele);
-
- public T remove();
-
- public Object[] getData();
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListService/KIStackList.java b/group01/1328404806/dataStructure/src/main/java/ListService/KIStackList.java
deleted file mode 100644
index 8a1f031976..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListService/KIStackList.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package ListService;
-
-//集合接口
-public interface KIStackList {
- public void push(T ele);
-
- public void pop();
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KArrayList.java b/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KArrayList.java
deleted file mode 100644
index d85a8957cf..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KArrayList.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package ListServiceImpl;
-
-import ListService.KIList;
-
-public class KArrayList implements KIList {
-
- /** 初始化的容量的大小 */
- private final static int INIT_CAPACITY = 12;
- private Object[] mList = null;
-
- /** 当前的容量 */
- private int mCurrentCapacity = 0;
- /** 容器中元素的个数 */
- private int mSize = 0;
-
- public KArrayList() {
- mList = new Object[INIT_CAPACITY];
- mCurrentCapacity = INIT_CAPACITY;
- }
-
- /**
- * 插入一个元素到链表尾部
- *
- * @param item
- */
- public void add(T item) {
- if (mSize == mCurrentCapacity) {
- expansion();
- }
- mList[mSize] = item;
- mSize++;
-
- }
-
- /**
- * 插入一个元素到指定位置,从插入位置及其后面的元素往后移动一个位置
- *
- * @param index
- * 要插入的位置
- * @param item
- */
- public void add(int index, T item) {
- if (index < 0 || index >= mSize) { // 不允许index小于0,或者index >= 数组当前大小
- throw new IndexOutOfBoundsException();
- }
- if (mSize == mCurrentCapacity) {
- expansion();
- }
- Object[] newList = new Object[mCurrentCapacity];
- System.arraycopy(mList, 0, newList, 0, index);
- System.arraycopy(mList, index, newList, index + 1, mSize - index);
- newList[index] = item;
- mList = newList;
- mSize++;
-
- }
-
- /**
- * 更新指定位置的元素
- *
- * @param index
- * @param item
- */
- public void set(int index, T item) {
- if (index < 0 || index >= mSize) {
- throw new IndexOutOfBoundsException();
- }
- mList[index] = item;
-
- }
-
- /**
- * 移除指定位置的元素,后面的元素向前移动一位
- *
- * @param index
- */
- public void remove(int index) {
- if (index < 0 || index >= mSize) {
- throw new IndexOutOfBoundsException();
- }
- Object[] newList = new Object[mCurrentCapacity];
- System.arraycopy(mList, 0, newList, 0, index);
- System.arraycopy(mList, index + 1, newList, index, mSize - index);
- mList = newList;
- mSize--;
-
- }
-
- /**
- * 移除链表中特定的元素。(如果item在链表中有多个,只移除第一个)
- *
- * @param item
- */
- public void remove(T item) {
- for (int i = 0; i < mSize; i++) {
- if (mList[i].equals(item)) {
- remove(i);
- break;
- }
- }
-
- }
-
- /**
- * 将链表清空,capacity不变
- */
- public void clear() {
- mList = new Object[mCurrentCapacity];
- mSize = 0;
-
- }
-
- /**
- * 判断是否包含某个元素
- *
- * @param item
- * @return true表示有这个元素,false表示没有这个元素
- */
- public boolean contains(T item) {
- for (int i = 0; i < mSize; i++) {
- if (mList[i].equals(item)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * 判断链表是否为空
- *
- * @return boolean
- */
- public boolean isEmpty() {
- return (mSize == 0) ? true : false;
- }
-
- /**
- * 获取指定位置的元素
- *
- * @param index
- * @return
- */
- @SuppressWarnings("unchecked")
- public T get(int index) {
- if (index < 0 || index >= mSize) {
- throw new IndexOutOfBoundsException();
- }
- return (T) mList[index];
- }
-
- /**
- * 获取特定元素所在的位置。 如果该链表中存在多个相同的元素,只返回第一个的位置,如果找不到,则返回-1。
- *
- * @param item
- * @return int 如果没找到,返回-1
- */
- public int indexOf(T item) {
- for (int i = 0; i < mSize; i++) {
- if (mList[i].equals(item)) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * 获取当前链表的长度
- *
- * @return int
- */
- public int size() {
- return mSize;
- }
-
- /**
- * 扩容,当 mSize == mCurrentCapacity 时调用
- */
- private void expansion() {
- Object[] oldList = mList;
- Object[] newList = new Object[getNewCapacity()];
- System.arraycopy(oldList, 0, newList, 0, oldList.length);
- mList = newList;
- }
-
- /**
- * 获取新的容量大小 当满的时候每次增加当前容量的50%
- */
- private int getNewCapacity() {
- return mCurrentCapacity = mCurrentCapacity + (mCurrentCapacity >> 1);
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KLinkedList.java b/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KLinkedList.java
deleted file mode 100644
index 6afb12befc..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KLinkedList.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package ListServiceImpl;
-
-import java.util.Iterator;
-
-import ListService.KILinkedList;
-
-public class KLinkedList implements Iterable, KILinkedList {
-
- // 记录链表的长度
- private int mSize = 0;
- // private int mActionCount = 0;
- // 开始和结束节点
- private Node mBeginNode, mLastNode;
-
- public KLinkedList() {
- // TODO Auto-generated constructor stub
- init();
- }
-
- /**
- * 初始化一个只有开始节点和结束节点的空链表
- */
- private void init() {
- // 将首位节点链接起来
- mBeginNode = new Node(null, null, null);
- mLastNode = new Node(null, mBeginNode, null);
- mBeginNode.nextNode = mLastNode;
- mSize = 0;
- // mActionCount++;
- }
-
- public int size() {
- return mSize;
- }
-
- public boolean isEmpty() {
- return mSize == 0 ? true : false;
- }
-
- /**
- * 在链表的pos位置之前放置t_node这个节点
- *
- * @param t_node
- * 需要放置的节点
- * @param pos
- * 放置节点在pos之前
- */
- private void add(Node newNode, int pos) {
- // 抛出不合法的位置
- if (pos < 0 || pos > mSize) {
- throw new IndexOutOfBoundsException();
- }
-
- // 链接新节点
- newNode.nextNode = getNode(pos);
- getNode(pos - 1).nextNode = newNode;
- getNode(pos).preNode = newNode;
- // mActionCount++;
- mSize++;
-
- }
-
- /**
- * t 供外部调用,直接在链表的末尾添加,即在mLastNode节点之前
- *
- * @param
- */
- public void add(T t) {
- add(new Node(t, null, null), mSize);
- }
-
- /**
- * 往链表pos位置之前添加数据t
- *
- * @param t
- * 添加的数据
- * @param pos
- * 添加在pos位置之前
- */
- public void add(T t, int pos) {
- add(new Node(t, null, null), pos);
- }
-
- /**
- *
- * @param pos
- * 链表中的某个位置
- * @return 翻去pos位置的节点 (此处的pos的范围是[-1,mSize],此方法是私有方法,外部访问不了,只共此类中呢个访问)
- */
- private Node getNode(int pos) {
- Node node;
- int currentPos;
- if (pos == -1) {
- // -1的位置是开始节点
- return mBeginNode;
- } else if (pos == mSize) {
- // mSize的位置是结束的节点
- return mLastNode;
- }
- // 因为这是双向节点,所以判断一下能提高搜索效率
- if (pos < mSize / 2) {
- currentPos = 0;
- node = mBeginNode.nextNode;
- while (currentPos < pos) {
- node = node.nextNode;
- currentPos++;
- }
- } else {
- node = mLastNode.preNode;
- currentPos = mSize - 1;
- while (currentPos > pos) {
- node = node.preNode;
- currentPos--;
- }
- }
- return node;
- }
-
- public T get(int pos) {
- return getNode(pos).t;
- }
-
- public void set(T t, int pos) {
- if (pos < 0 || pos >= mSize) {
- throw new IndexOutOfBoundsException();
- }
- getNode(pos).t = t;
- }
-
- /**
- * 删除特定位置的节点
- *
- * @param t_node
- * 需要删除节点的位置
- * @return
- */
- private T remove(Node t_node) {
-
- t_node.preNode.nextNode = t_node.nextNode;
- t_node.nextNode.preNode = t_node.preNode;
- // 最好在此处给其设置为空,不要其链接到其他节点,因为已经被销毁,不再持有其他的节点的引用
- t_node.nextNode = null;
- t_node.preNode = null;
- mSize--;
- // mActionCount++;
- return t_node.t;
- }
-
- public T remove(int pos) {
- if (pos < 0 || pos >= mSize) {
- throw new IndexOutOfBoundsException();
- }
- Node tempNode = getNode(pos);
- remove(tempNode);
- return tempNode.t;
- }
-
- public Iterator iterator() {
-
- return new MyLinkedListIterator();
- }
-
- private class MyLinkedListIterator implements Iterator {
-
- private int currentPos = 0;
-
- public boolean hasNext() {
- // TODO Auto-generated method stub
- if (currentPos < mSize) {
- return true;
- }
- return false;
- }
-
- public T next() {
- // TODO Auto-generated method stub
- return (T) getNode(currentPos++).t;
- }
-
- public void remove() {
- // TODO Auto-generated method stub
- KLinkedList.this.remove(getNode(--currentPos));
- ;
- }
-
- }
-
- // 静态内部类,定义的节点,双向链表,需要一个指向前面一项的引用域和一个指向后面一项的引用域,方便查找
- private static class Node {
- public T t;
- public Node preNode;
- public Node nextNode;
-
- public Node(T t, Node preNode, Node nextNode) {
- this.preNode = preNode;
- this.nextNode = nextNode;
- this.t = t;
- }
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KQueueList.java b/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KQueueList.java
deleted file mode 100644
index 7ea8643c43..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KQueueList.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package ListServiceImpl;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import ListService.KIQueueList;
-
-public class KQueueList implements KIQueueList{
-
- /** 初始容量 */
- public static final int DEFAULT_SIZE = 10;
- /** 容量不足时翻倍数 */
- public static final float DEFAULT_INCREMENT = 1.5f;
- /** 数据 */
- private Object[] elementData;
- /** 元素个数 */
- private int elementCount;
- /** 数组的头部,即 下次删除数据的 index */
- private int head;
- /** 数组的尾部,即 下次插入数据的 index */
- private int tail;
-
- public KQueueList() {
- this(DEFAULT_SIZE);
- }
-
- public KQueueList(int size) {
- this.elementData = new Object[size];
- this.elementCount = 0;
- this.head = 0;
- this.tail = 0;
- }
-
- public KQueueList(Object[] data) {
- this.elementData = data;
- this.elementCount = data.length;
- this.head = 0;
- this.tail = 0;
- }
-
- public KQueueList(Collection extends T> c) {
- this(c.toArray());
- }
-
- /**
- * 添加数据 到尾部
- *
- * @param ele
- * @return
- */
- public T add(T ele) {
- if (tail >= elementData.length) {
- adjustData();
- }
- elementData[tail] = ele;
- elementCount++;
- tail++;
- return ele;
- };
-
- /**
- * 删除数据 从头部
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public T remove() {
- T e = (T) elementData[head];
- elementData[head] = null;
- elementCount--;
- head++;
- return e;
- };
-
- /**
- * 获得当前的数据
- *
- * @return
- */
- public Object[] getData() {
- return Arrays.copyOfRange(this.elementData, this.head, this.tail);
- }
-
- public void adjustData() {
- if (tail >= elementData.length) { // tail 处空间不足时调用
- // head 的空位去掉
- int newSize = (elementData.length == elementCount) ? (int) Math.ceil(elementCount * DEFAULT_INCREMENT)
- : elementData.length;
- elementData = Arrays.copyOfRange(elementData, head, elementData.length);
- // 调整空间
- elementData = Arrays.copyOf(elementData, newSize);
- tail = elementCount;
- head = 0;
- }
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KStackList.java b/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KStackList.java
deleted file mode 100644
index e2b9ee1186..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/ListServiceImpl/KStackList.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package ListServiceImpl;
-
-import java.util.Arrays;
-
-import ListService.KIStackList;
-
-public class KStackList implements KIStackList{
- Object[] data;
- private int capacity;
- private int size;
-
- public KStackList()
- {
- capacity=16;
- size=0;
- data=new Object[capacity];
- }
-
- public void ensureCapacity() {
- capacity = capacity * 2;
- data = Arrays.copyOf(data, capacity);
- }
-
- //压入栈底
- public void push(T ele) {
- if (size < capacity) {
- data[size++] = ele;
- } else {
- ensureCapacity();
- data[size++] = ele;
- }
- }
-
- //弹出
- public void pop() {
- if (size > 0) {
- System.out.println(data[size - 1]);
- data[--size] = null;
- } else {
- System.out.println("Empty stack!");
- }
- }
-
- boolean isEmpty() {
- return size == 0;
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/main/java/increaseLearning/dataStructure/App.java b/group01/1328404806/dataStructure/src/main/java/increaseLearning/dataStructure/App.java
deleted file mode 100644
index 018ba70bdb..0000000000
--- a/group01/1328404806/dataStructure/src/main/java/increaseLearning/dataStructure/App.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package increaseLearning.dataStructure;
-
-/**
- * Hello world!
- *
- */
-public class App
-{
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
- }
-}
diff --git a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/AppTest.java b/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/AppTest.java
deleted file mode 100644
index 4fffcb78ed..0000000000
--- a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/AppTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package increaseLearning.dataStructure;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testApp()
- {
- assertTrue( true );
- }
-}
diff --git a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/arrayListTest.java b/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/arrayListTest.java
deleted file mode 100644
index 3815775989..0000000000
--- a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/arrayListTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package increaseLearning.dataStructure;
-
-
-import org.junit.Test;
-
-import ListServiceImpl.KArrayList;
-import junit.framework.TestCase;
-
-public class arrayListTest extends TestCase {
- @Test
- public void testArrayList() {
-
- KArrayList arr = new KArrayList();
-
- for (int i = 1; i <= 50; i++) {
- arr.add(i);
- }
-
- arr.add(10, 99);
- arr.add(0, 99);
-
- System.out.println(arr.get(51));
- System.out.println(arr.get(11));
-
- // arr.clear();
-
- // System.out.println(arr.contains(99));
- // System.out.println(arr.indexOf(59));
-
- arr.remove(11);
-
- arr = null;
-
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/linkedListTest.java b/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/linkedListTest.java
deleted file mode 100644
index 6b42a261fa..0000000000
--- a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/linkedListTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package increaseLearning.dataStructure;
-
-import org.junit.Test;
-
-import ListServiceImpl.KLinkedList;
-import junit.framework.TestCase;
-
-public class linkedListTest extends TestCase{
- @Test
- public void testLinkedList(){
- KLinkedList linkList=new KLinkedList();
-
-
- linkList.add(3, 0);
-
- System.out.println(linkList.get(0));
-// System.out.println("成功!!!");
-
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/queueListTest.java b/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/queueListTest.java
deleted file mode 100644
index af4f952f6c..0000000000
--- a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/queueListTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package increaseLearning.dataStructure;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import ListServiceImpl.KQueueList;
-import junit.framework.TestCase;
-
-public class queueListTest extends TestCase {
- @Test
- public void testQueueList() {
- KQueueList queueOne = new KQueueList();
- // 第1次 加入个数
- int addCountOne = 30;
- // 第1次 删除个数
- int removeCountOne = 20;
- // 第2次 加入个数
- int addCountTwo = 10;
-
- for (int i = 0; i < addCountOne; i++) {
- queueOne.add(i);
- }
- Object[] data = queueOne.getData();
- for (int i = 0; i < data.length; i++) {
- Assert.assertTrue((Integer) data[i] == i);
- }
-
- for (int i = 0; i < removeCountOne; i++) {
- Assert.assertTrue(queueOne.remove() == i);
- }
-
- for (int i = 0; i < addCountTwo; i++) {
- queueOne.add(i * 10);
- }
- Object[] data2 = queueOne.getData();
- int baseCount = addCountOne - removeCountOne;
- for (int i = 0; i < addCountTwo; i++) {
- Assert.assertTrue((Integer) data2[baseCount + i] == i * 10);
- }
- }
-
-}
diff --git a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/stackListTest.java b/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/stackListTest.java
deleted file mode 100644
index 614f18cb8c..0000000000
--- a/group01/1328404806/dataStructure/src/test/java/increaseLearning/dataStructure/stackListTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package increaseLearning.dataStructure;
-
-import org.junit.Test;
-
-import ListServiceImpl.KStackList;
-import junit.framework.TestCase;
-
-public class stackListTest extends TestCase{
- @Test
- public void testStackList(){
- KStackList fcStack=new KStackList();
- for(int i=0;i<10;i++)
- {
- fcStack.push(i);
- System.out.println(fcStack);
- }
-
- for(int i=0;i<10;i++)
- {
- fcStack.pop();
- System.out.println(fcStack);
- }
- fcStack.pop();
- }
-
-}
diff --git a/group01/1664823950/.classpath b/group01/1664823950/.classpath
deleted file mode 100644
index fb5011632c..0000000000
--- a/group01/1664823950/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/group01/1664823950/.gitignore b/group01/1664823950/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group01/1664823950/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group01/1664823950/.project b/group01/1664823950/.project
deleted file mode 100644
index 6cca5cf64b..0000000000
--- a/group01/1664823950/.project
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-<<<<<<< HEAD:group01/1664823950/.project
- 1664823950
-=======
- 1264835468
->>>>>>> master:group17/1264835468/.project
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/1664823950/src/com/coding/basic/ArrayList.java b/group01/1664823950/src/com/coding/basic/ArrayList.java
deleted file mode 100644
index 87928e7483..0000000000
--- a/group01/1664823950/src/com/coding/basic/ArrayList.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.coding.basic;
-
-public class ArrayList implements List
-{
-
- private int size = 0;
-
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o)
- {
- elementData[size] = o;
- size ++;
- }
-
- public void add(int index, Object o)
- {
- if(index > size || index < 0)
- {
- return;
- }
- else
- {
- for (int i = size-1; i > index; i--)
- {
- elementData[i+1] = elementData[size];
- }
- elementData[index] = o;
- size++;
- }
-
- }
-
- public Object get(int index)
- {
- if(index < size || index >= 0)
- {
- return elementData[index];
- }
- return null;
- }
-
- public Object remove(int index)
- {
- Object removedObj;
- if(index >= size || index < 0)
- {
- removedObj = null;
- }
- else
- {
- removedObj = elementData[index];
- for (int j = index; j < elementData.length; j++)
- {
- elementData[j] = elementData[j+1];
- }
- size--;
- }
- return removedObj;
- }
-
- public int size()
- {
- return size;
- }
-
- public Iterator iterator()
- {
- return null;
- }
-
-}
diff --git a/group01/1664823950/src/com/coding/basic/BinaryTreeNode.java b/group01/1664823950/src/com/coding/basic/BinaryTreeNode.java
deleted file mode 100644
index 24710872cb..0000000000
--- a/group01/1664823950/src/com/coding/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.coding.basic;
-
-public class BinaryTreeNode
-{
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o)
- {
- return null;
- }
-
-}
diff --git a/group01/1664823950/src/com/coding/basic/Iterator.java b/group01/1664823950/src/com/coding/basic/Iterator.java
deleted file mode 100644
index e5ccd24b42..0000000000
--- a/group01/1664823950/src/com/coding/basic/Iterator.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.coding.basic;
-
-public interface Iterator
-{
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/1664823950/src/com/coding/basic/LinkedList.java b/group01/1664823950/src/com/coding/basic/LinkedList.java
deleted file mode 100644
index 2a217b2df7..0000000000
--- a/group01/1664823950/src/com/coding/basic/LinkedList.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.coding.basic;
-
-public class LinkedList implements List
-{
-
- private Node head;
- private Node tail;
-
- public void add(Object o)
- {
- Node n = new Node(o);
- tail.next = n;
- tail = n;
- }
-
- public void add(int index , Object o)
- {
- Node n = new Node(o);
- getNode(index-1).next = n;
- n.next = getNode(index);
- }
-
- private Node getNode(int index)
- {
- Node n = head;
- int counter = 0;
- while (counter
-
-
-
-
-
-
diff --git a/group01/1814014897/zhouhui/.gitignore b/group01/1814014897/zhouhui/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group01/1814014897/zhouhui/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group01/1814014897/zhouhui/.project b/group01/1814014897/zhouhui/.project
deleted file mode 100644
index fab8d7f04c..0000000000
--- a/group01/1814014897/zhouhui/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- 2017Learning
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/1814014897/zhouhui/.settings/org.eclipse.jdt.core.prefs b/group01/1814014897/zhouhui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 3a21537071..0000000000
--- a/group01/1814014897/zhouhui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-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/group01/1814014897/zhouhui/src/week01/BasicDataStructure/ArrayList.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/ArrayList.java
deleted file mode 100644
index 23ed3f6bc2..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/ArrayList.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package week01.BasicDataStructure;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
- ensureCapacity(size + 1); //size increase,in order to have enough capacity.
- elementData[size++] = o; //similar to: elementData[size]=o; size++;
- }
-
- private void ensureCapacity(int minCapacity){
- if(minCapacity > elementData.length){
- grow(minCapacity);
- }
- }
-
- private void grow(int minCapacity){
- int oldCapacity = elementData.length;
- int newCapacity = oldCapacity + ( oldCapacity >> 1 );
- if(newCapacity < minCapacity){
- newCapacity = minCapacity;
- }
- elementData = Arrays.copyOf(elementData, newCapacity);
-
- }
-
- public void add(int index, Object o){
- if(index < 0 || index > size) throw new IndexOutOfBoundsException("Index:"+index+",Size:"+size);
- ensureCapacity(size+1);
- System.arraycopy(elementData, index, elementData, index + 1, size - index);
- elementData[index] = o;
- size++;
- }
-
- public Object get(int index){
- if(index < 0 || index >= size) throw new IndexOutOfBoundsException("Index:"+index+",Size:"+size);
- return elementData[index];
- }
-
- public Object remove(int index){
- if(index < 0 || index >= size) throw new IndexOutOfBoundsException("Index:"+index+",Size:"+size);
- Object data_index = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
- elementData[size - 1] = null;
- size--;
- return data_index;
- }
-
- public int size(){
- return size;
- }
-
- public Iterator iterator(){
- return new ArrayListIterator();
- }
-
- private class ArrayListIterator implements Iterator{
-
- private int pos = 0;
-
- public boolean hasNext() {
- return pos < size;
- }
-
- public Object next() {
- return elementData[pos++];
- }
- }
-
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/BinaryTreeNode.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/BinaryTreeNode.java
deleted file mode 100644
index a4fb2cf8b9..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/BinaryTreeNode.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package week01.BasicDataStructure;
-
-public class BinaryTreeNode{
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(Object data){
- this.data = data;
- left = null;
- right = null;
- }
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- if((Integer)o < (Integer)this.data)
- {
- if(this.left == null){
- BinaryTreeNode node = new BinaryTreeNode(o);
- this.setLeft(node);
- return node;
- }else{
- return this.left.insert(o);
- }
- }else{
- if(this.right == null){
- BinaryTreeNode node = new BinaryTreeNode(o);
- this.setRight(node);
- return node;
- }else{
- return this.right.insert(o);
- }
- }
- }
- }
-
-
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Iterator.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Iterator.java
deleted file mode 100644
index 0ad3fff8f3..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package week01.BasicDataStructure;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/LinkedList.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/LinkedList.java
deleted file mode 100644
index 35b1158cd1..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/LinkedList.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package week01.BasicDataStructure;
-
-public class LinkedList implements List {
-
- private Node head;
- private int size = 0;
-
- public void add(Object o){
- if(head == null){
- head = new Node(o);
- }else{
- Node pos = head;
- while(pos.next != null){
- pos = pos.next;
- }
- pos.next = new Node(o);
- }
- size++;
- }
-
- public void add(int index , Object o){
- if(index < 0 || index >size ) throw new IndexOutOfBoundsException("Index:"+index+",Size"+size);
- if(index == 0) {
- Node node = new Node(o);
- node.next = head;
- head = node;
- }
- else{
- Node pos = head;
- for(int i = 0;i < index-1;i++){
- pos = pos.next;
- }
- Node node = new Node(o);
- node.next = pos.next;
- pos.next = node;
- }
- size++;
- }
-
- public Object get(int index){
- if(index < 0 || index >=size ) throw new IndexOutOfBoundsException("Index:"+index+",Size"+size);
- Node pos = head;
- for(int i = 0;i < index;i++){
- pos = pos.next;
- }
- return pos.data;
- }
-
- public Object remove(int index){
- if(index < 0 || index >=size ) throw new IndexOutOfBoundsException("Index:"+index+",Size:"+size);
- Node element = head;
- if(index == 0){
- head = head.next;
- }else{
- Node pos = head;
- for(int i = 0;i < index - 1;i++){
- pos = pos.next;
- }
- element = pos.next;
- pos.next = pos.next.next;
- }
- size--;
- return element.data;
- }
-
- public int size(){
- return size;
- }
-
- public void addFirst(Object o){
- add(0,o);
- }
- public void addLast(Object o){
- add(size,o);
- }
- public Object removeFirst(){
- return remove(0);
- }
- public Object removeLast(){
- return remove(size-1);
- }
- public Iterator iterator(){
- return new LinkedListIterator();
- }
-
- class LinkedListIterator implements Iterator{
-
- private Node node = head;
- private int pos = 0;
- @Override
- public boolean hasNext() {
- return pos < size;
- }
-
- @Override
- public Object next() {
- pos++;
- if(pos != 1){
- node = node.next;
- }
- return node.data;
- }
- }
-
- private static class Node{
- Object data;
- Node next;
- public Node(Object data){
- this.data = data;
- next = null;
- }
- }
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/List.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/List.java
deleted file mode 100644
index 7806b75ed3..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package week01.BasicDataStructure;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Queue.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Queue.java
deleted file mode 100644
index e0ab6bbb9c..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Queue.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package week01.BasicDataStructure;
-
-public class Queue {
-
- private LinkedList linkedList = new LinkedList();
- private int size = 0;
-
- public void enQueue(Object o){
- linkedList.add(o);
- size++;
- }
-
- public Object deQueue(){
- size--;
- return linkedList.removeFirst();
- }
-
- public boolean isEmpty(){
- return linkedList.size() == 0;
- }
-
- public int size(){
- return size;
- }
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Stack.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Stack.java
deleted file mode 100644
index 53f99b37c7..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructure/Stack.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package week01.BasicDataStructure;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
- private int size = 0;
-
- public void push(Object o){
- elementData.add(o);
- size++;
- }
-
- public Object pop(){
- return elementData.remove(--size);
- }
-
- public Object peek(){
- return elementData.get(size - 1);
- }
- public boolean isEmpty(){
- return elementData.size() == 0;
- }
- public int size(){
- return elementData.size();
- }
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/AllTest.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/AllTest.java
deleted file mode 100644
index 5d5f07d815..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/AllTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package week01.BasicDataStructureTest;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({
- ArrayListTest.class,
- BinaryTreeNodeTest.class,
- LinkedListTest.class,
- QueueTest.class,
- StackTest.class
-})
-
-public class AllTest {
-
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/ArrayListTest.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/ArrayListTest.java
deleted file mode 100644
index c5513acfda..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/ArrayListTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package week01.BasicDataStructureTest;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.BasicDataStructure.ArrayList;
-import week01.BasicDataStructure.Iterator;
-
-public class ArrayListTest {
-
- private ArrayList arrayList = new ArrayList();
-
- @Before
- public void setUp() throws Exception {
- for(int i = 0;i < 100 ; i++){
- arrayList.add(i);
- }
- }
-
- @Test
- public void testAddObject() {
- for(int i = 0;i < 100;i++){
- Assert.assertEquals(arrayList.get(i), i);
- }
- }
-
- @Test
- public void testAddIntObject() {
- arrayList.add(0,10);
- arrayList.add(22, 44);
- arrayList.add(40, 5);
- arrayList.add(100,88);
- Assert.assertEquals(arrayList.get(0), 10);
- Assert.assertEquals(arrayList.get(22),44);
- Assert.assertEquals(arrayList.get(40), 5);
- Assert.assertEquals(arrayList.get(100), 88);
- }
-
- @Test
- public void testGet() {
- Assert.assertEquals(arrayList.get(0), 0);
- Assert.assertEquals(arrayList.get(33), 33);
- Assert.assertEquals(arrayList.get(77), 77);
- Assert.assertEquals(arrayList.get(99), 99);
- }
-
- @Test
- public void testRemove() {
- Assert.assertEquals(arrayList.remove(0), 0);
- Assert.assertEquals(arrayList.remove(0), 1);
- Assert.assertEquals(arrayList.remove(97), 99);
- Assert.assertEquals(arrayList.size(), 97);
- }
-
- @Test
- public void testSize() {
- Assert.assertEquals(arrayList.size(), 100);
- arrayList.add(5,5);
- Assert.assertEquals(arrayList.size(),101);
- arrayList.remove(5);
- Assert.assertEquals(arrayList.size(), 100);
- }
-
- @Test
- public void testIterator() {
- Iterator iterator = arrayList.iterator();
- for(int i=0;iterator.hasNext();i++){
- Assert.assertEquals(iterator.next(),i);
- }
- }
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/BinaryTreeNodeTest.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/BinaryTreeNodeTest.java
deleted file mode 100644
index 724e6c0e03..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/BinaryTreeNodeTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package week01.BasicDataStructureTest;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.BasicDataStructure.BinaryTreeNode;
-
-
-public class BinaryTreeNodeTest {
-
- private BinaryTreeNode root = new BinaryTreeNode(5);
-
- @Before
- public void setUp() throws Exception {
- root.insert(2);
- root.insert(7);
- root.insert(1);
- root.insert(6);
- }
-
- @Test
- public void testGetData() {
- Assert.assertEquals(root.getData(), 5);
- Assert.assertEquals(root.getLeft().getData(), 2);
- Assert.assertEquals(root.getRight().getData(), 7);
- Assert.assertEquals(root.getLeft().getLeft().getData(), 1);
- Assert.assertEquals(root.getRight().getLeft().getData(), 6);
- }
-
- @Test
- public void testSetData() {
- root.setData(8);
- Assert.assertEquals(root.getData(),8);
- root.getLeft().setData(88);
- Assert.assertEquals(root.getLeft().getData(),88);
- root.getRight().setData(888);
- Assert.assertEquals(root.getRight().getData(),888);
- }
-
- @Test
- public void testGetLeft() {
- BinaryTreeNode node_left = root.getLeft();
- Assert.assertEquals(node_left.getData(), 2);
- BinaryTreeNode node_left_left = root.getLeft().getLeft();
- Assert.assertEquals(node_left_left.getData(), 1);
- }
-
- @Test
- public void testSetLeft() {
- BinaryTreeNode node = new BinaryTreeNode(100);
- root.setLeft(node);
- Assert.assertEquals(root.getLeft().getData(), 100);
- }
-
- @Test
- public void testGetRight() {
- BinaryTreeNode node_right = root.getRight();
- Assert.assertEquals(node_right.getData(), 7);
- root.insert(8);
- BinaryTreeNode node_right_right = root.getRight().getRight();
- Assert.assertEquals(node_right_right.getData(), 8);
- }
-
- @Test
- public void testSetRight() {
- BinaryTreeNode node = new BinaryTreeNode(100);
- root.setRight(node);
- Assert.assertEquals(root.getRight().getData(), 100);
- }
-
- @Test
- public void testInsert() {
- root.insert(4);
- root.insert(8);
- Assert.assertEquals(root.getLeft().getRight().getData(), 4);
- Assert.assertEquals(root.getRight().getRight().getData(), 8);
- }
-
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/LinkedListTest.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/LinkedListTest.java
deleted file mode 100644
index 2fb20d12f4..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/LinkedListTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package week01.BasicDataStructureTest;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.BasicDataStructure.Iterator;
-import week01.BasicDataStructure.LinkedList;
-
-public class LinkedListTest {
-
- private LinkedList linkedList = new LinkedList();
-
- @Before
- public void setUp() throws Exception {
- for(int i=0;i<100;i++){
- linkedList.add(i);
- }
- }
-
- @Test
- public void testAddObject() {
- for(int i=0;i<200;i++){
- linkedList.add(i);
- }
- for(int i=0;i<100;i++){
- Assert.assertEquals(linkedList.get(i), i);
- }
- for(int i=100;i<300;i++){
- Assert.assertEquals(linkedList.get(i), i-100);
- }
- }
-
- @Test
- public void testAddIntObject() {
- linkedList.add(0, 10);
- Assert.assertEquals(linkedList.get(0), 10);
- linkedList.add(5,60);
- Assert.assertEquals(linkedList.get(5), 60);
- Assert.assertEquals(linkedList.get(101), 99);
- }
-
- @Test
- public void testGet() {
- for(int i =0;i<100;i++){
- Assert.assertEquals(linkedList.get(i), i);
- }
- }
-
- @Test
- public void testRemove() {
- Assert.assertEquals(linkedList.remove(0), 0);
- Assert.assertEquals(linkedList.remove(0), 1);
- Assert.assertEquals(linkedList.size(), 98);
- linkedList.remove(97);
- Assert.assertEquals(linkedList.get(96), 98);
- }
-
- @Test
- public void testSize() {
- linkedList.add(0);
- Assert.assertEquals(linkedList.size(), 101);
- linkedList.add(0, 10);
- Assert.assertEquals(linkedList.size(), 102);
- linkedList.remove(0);
- Assert.assertEquals(linkedList.size(), 101);
- }
-
- @Test
- public void testAddFirst() {
- linkedList.addFirst(22);
- Assert.assertEquals(linkedList.get(0), 22);
- linkedList.addFirst(44);
- Assert.assertEquals(linkedList.get(0), 44);
- Assert.assertEquals(linkedList.size(), 102);
- }
-
- @Test
- public void testAddLast() {
- linkedList.addLast(22);
- Assert.assertEquals(linkedList.get(100), 22);
- linkedList.addLast(44);
- Assert.assertEquals(linkedList.get(101), 44);
- }
-
- @Test
- public void testRemoveFirst() {
- Assert.assertEquals(linkedList.removeFirst(), 0);
- Assert.assertEquals(linkedList.removeFirst(), 1);
- }
-
- @Test
- public void testRemoveLast() {
- Assert.assertEquals(linkedList.removeLast(),99 );
- Assert.assertEquals(linkedList.removeLast(), 98);
- }
-
- @Test
- public void testIterator() {
- Iterator iterator = linkedList.iterator();
- for(int i = 0;iterator.hasNext();i++){
- Assert.assertEquals(iterator.next(), i);
- }
- }
-
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/QueueTest.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/QueueTest.java
deleted file mode 100644
index 7302b5ec38..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/QueueTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package week01.BasicDataStructureTest;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.BasicDataStructure.Queue;
-
-
-public class QueueTest {
-
- Queue queue = new Queue();
-
- @Before
- public void setUp() throws Exception {
- for(int i=0;i<100;i++){
- queue.enQueue(i);
- }
- }
-
- @Test
- public void testEnQueue() {
- Assert.assertEquals(queue.size(), 100);
- for(int i =0;i<100;i++){
- queue.enQueue(i);
- }
- Assert.assertEquals(queue.size(), 200);
- }
-
- @Test
- public void testDeQueue() {
- for(int i =0;i<100;i++){
- Assert.assertEquals(queue.deQueue(), i);
- }
-
- }
-
- @Test
- public void testIsEmpty() {
- Assert.assertEquals(queue.isEmpty(), false);
- for(int i=0;i<100;i++){
- queue.deQueue();
- }
- Assert.assertEquals(queue.isEmpty(), true);
- }
-
- @Test
- public void testSize() {
- Assert.assertEquals(queue.size(), 100);
- queue.enQueue(100);
- Assert.assertEquals(queue.size(), 101);
- queue.deQueue();
- Assert.assertEquals(queue.size(), 100);
- }
-
-}
diff --git a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/StackTest.java b/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/StackTest.java
deleted file mode 100644
index ae6d3a39d4..0000000000
--- a/group01/1814014897/zhouhui/src/week01/BasicDataStructureTest/StackTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package week01.BasicDataStructureTest;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import week01.BasicDataStructure.Stack;
-
-
-public class StackTest {
-
- Stack stack = new Stack();
-
- @Before
- public void setUp() throws Exception {
- for(int i =0 ;i <100;i++){
- stack.push(i);
- }
- }
-
- @Test
- public void testPush() {
- Assert.assertEquals(stack.peek(), 99);
- for(int i =0;i <200;i++){
- stack.push(i);
- }
- Assert.assertEquals(stack.peek(), 199);
- Assert.assertEquals(stack.size(), 300);
- }
-
- @Test
- public void testPop() {
- Assert.assertEquals(stack.pop(), 99);
- Assert.assertEquals(stack.pop(), 98);
- for(int i=0;i<98;i++){
- stack.pop();
- }
- Assert.assertEquals(stack.size(), 0);
- }
-
- @Test
- public void testPeek() {
- for(int i=0;i<100;i++){
- Assert.assertEquals(stack.peek(), 99);
- Assert.assertEquals(stack.size(), 100);
- }
- stack.pop();
- Assert.assertEquals(stack.peek(), 98);
- Assert.assertEquals(stack.peek(), 98);
- }
-
- @Test
- public void testIsEmpty() {
- Assert.assertEquals(stack.isEmpty(), false);
- for(int i =0 ;i <100;i++){
- stack.pop();
- }
- Assert.assertEquals(stack.isEmpty(), true);
- }
-
- @Test
- public void testSize() {
- stack.push(100);
- Assert.assertEquals(stack.size(), 101);
- stack.pop();
- Assert.assertEquals(stack.size(), 100);
- stack.peek();
- Assert.assertEquals(stack.size(), 100);
- }
-
-}
diff --git a/group01/1925347167/Week1 Basic Data Structure/ArrayList.java b/group01/1925347167/Week1 Basic Data Structure/ArrayList.java
deleted file mode 100644
index 2797e0b129..0000000000
--- a/group01/1925347167/Week1 Basic Data Structure/ArrayList.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.coding.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
- if (fullCheck())
- elementData = Arrays.copyOf(elementData, size*2);
- elementData[size++] = o;
- }
- public void add(int index, Object o){
-
- if (fullCheck())
- elementData = Arrays.copyOf(elementData, size*2);
- if (!rangeCheck(index))
- throw new IndexOutOfBoundsException();
- for (int i = size; i > index; --i)
- elementData[i] = elementData[i-1];
- elementData[index] = o;
- size++;
- }
-
- public Object get(int index){
- if (rangeCheck(index))
- return elementData[index];
- throw new IndexOutOfBoundsException();
- }
-
- public Object remove(int index){
- if (!rangeCheck(index))
- throw new IndexOutOfBoundsException();
- Object rmo = elementData[index];
- for (int i = index; i < size-1; ++i)
- elementData[i] = elementData[i-1];
- size--;
- return rmo;
- }
-
- public int size(){
- return size;
- }
-
- public Iterator iterator(){
- return null;
- }
-
- private boolean rangeCheck(int index) {
- if (index < 0 || index >= size)
- return false;
- return true;
- }
-
- private boolean fullCheck() {
- if (size >= elementData.length)
- return true;
- return false;
- }
-
-}
diff --git a/group01/1925347167/Week1 Basic Data Structure/BinaryTreeNode.java b/group01/1925347167/Week1 Basic Data Structure/BinaryTreeNode.java
deleted file mode 100644
index 45827be3a5..0000000000
--- a/group01/1925347167/Week1 Basic Data Structure/BinaryTreeNode.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.coding.basic;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(Object o) {
- data = o;
- left = null;
- right = null;
- }
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
diff --git a/group01/1925347167/Week1 Basic Data Structure/LinkedList.java b/group01/1925347167/Week1 Basic Data Structure/LinkedList.java
deleted file mode 100644
index 3097f69edc..0000000000
--- a/group01/1925347167/Week1 Basic Data Structure/LinkedList.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package com.coding.basic;
-
-public class LinkedList implements List {
-
- private Node head;
-
- private int size = 0;
-
- public void add(Object o){
- Node tmp = head;
- while (tmp.next != null)
- tmp = tmp.next;
-
- Node n = new Node(o);
- tmp.next = n;
- size++;
- }
- public void add(int index , Object o){
- if (!rangeCheck(index))
- throw new IndexOutOfBoundsException();
-
- if (index == 0) {
- Node newhead = new Node(o);
- newhead.next = head;
- head = newhead;
- } else {
- Node tmp = head;
- for (int i = 0; i < index - 1; ++i)
- tmp = tmp.next;
- Node node = new Node(o);
- node.next = tmp.next;
- tmp.next = node;
- }
-
- size++;
- }
- public Object get(int index){
- if (!rangeCheck(index))
- throw new IndexOutOfBoundsException();
- Node tmp = head;
- for (int i = 0; i < index - 1; ++i)
- tmp = tmp.next;
- return tmp.data;
-
- }
-
- public Object remove(int index){
- if (!rangeCheck(index))
- throw new IndexOutOfBoundsException();
-
- if (index == 0) {
- Node oldHead= head;
- head = head.next;
- size--;
- return oldHead.data;
- }else {
- Node tmp = head;
- for (int i = 0; i < index - 1; i++) {
- tmp = tmp.next;
- }
- Node node = tmp.next;
- tmp.next = node.next;
- size--;
- return node.data;
- }
- }
-
- public int size(){
- return size;
- }
-
- public void addFirst(Object o){
- Node newHead = new Node(o);
- newHead.next = head;
- head = newHead;
- size++;
- }
- public void addLast(Object o){
- Node tmp = head;
- while (tmp.next != null) {
- tmp = tmp.next;
- }
- Node node = new Node(o);
- tmp.next = node;
- size++;
- }
- public Object removeFirst(){
- if (head == null)
- throw new IndexOutOfBoundsException();
- Node oldHead = head;
- head = head.next;
- size--;
- return oldHead.data;
- }
- public Object removeLast(){
- if (head == null)
- throw new IndexOutOfBoundsException();
- Node tmp = head;
- while (tmp.next.next != null) {
- tmp = tmp.next;
- }
- Node node = tmp.next;
- tmp.next = null;
- size--;
- return node.data;
- }
- public Iterator iterator(){
- return null;
- }
-
- private boolean rangeCheck(int index) {
- if (index < 0 || index >= size)
- return false;
- return true;
- }
-
- private static class Node{
- Object data;
- Node next;
-
- Node(Object data) {
- this.data = data;
- next = null;
- }
-
- }
-}
diff --git a/group01/1925347167/Week1 Basic Data Structure/Queue.java b/group01/1925347167/Week1 Basic Data Structure/Queue.java
deleted file mode 100644
index b8c394b833..0000000000
--- a/group01/1925347167/Week1 Basic Data Structure/Queue.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.coding.basic;
-
-public class Queue {
-
- private LinkedList llist = new LinkedList();
-
- public void enQueue(Object o){
- llist.add(o);
- }
-
- public Object deQueue(){
- if (isEmpty())
- return null;
- return llist.removeFirst();
- }
-
- public boolean isEmpty(){
- return (llist.size()==0);
- }
-
- public int size(){
- return -llist.size();
- }
-}
diff --git a/group01/1925347167/Week1 Basic Data Structure/Stack.java b/group01/1925347167/Week1 Basic Data Structure/Stack.java
deleted file mode 100644
index 4458cb61d7..0000000000
--- a/group01/1925347167/Week1 Basic Data Structure/Stack.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.coding.basic;
-
-public class Stack {
-
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o){
- elementData.add(o);
- }
-
- public Object pop(){
- if (isEmpty())
- return null;
- return elementData.remove(elementData.size() - 1);
- }
-
- public Object peek(){
- if (elementData.size() == 0)
- return null;
- return elementData.get(elementData.size() - 1);
- }
- public boolean isEmpty(){
- return (elementData.size() == 0);
- }
- public int size(){
- return elementData.size();
- }
-}
diff --git a/group01/2137642225/work01/.classpath b/group01/2137642225/work01/.classpath
deleted file mode 100644
index 2d7497573f..0000000000
--- a/group01/2137642225/work01/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/group01/2137642225/work01/.gitignore b/group01/2137642225/work01/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group01/2137642225/work01/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group01/2137642225/work01/.project b/group01/2137642225/work01/.project
deleted file mode 100644
index f8dde642e5..0000000000
--- a/group01/2137642225/work01/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- work01
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/ArrayList.java b/group01/2137642225/work01/src/com/coding/mybasic/ArrayList.java
deleted file mode 100644
index 1826ee7c50..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/ArrayList.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.coding.mybasic;
-
-public class ArrayList implements List{
-
- private static final int DEF_CAPACITY = 10;
- private int size;
- private Object[] elementData;
-
- public ArrayList(){
- elementData = new Object[DEF_CAPACITY];
- }
-
- public ArrayList(int initCapacity) {
- if(initCapacity <= 0){
- throw new RuntimeException("初始化长度必须大于0");
- }
- elementData = new Object[initCapacity];
- }
-
- @Override
- public void add(Object element) {
- checkArrayOutOfRange();
- elementData[size++] = element;
- }
-
-
- @Override
- public void add(int index, Object element) {
- // 末尾插入
- if(index == size){
- add(element);
- return;
- }
- // index 在 0到size 之间,index之后元素要后移
- checkIndex(index);
- checkArrayOutOfRange();
- moveBackwardElement(index);
- elementData[index] = element;
- size++;
- }
-
-
- @Override
- public Object get(int index) {
- checkIndex(index);
- return elementData[index];
- }
-
- @Override
- public Object remove(int index) {
- checkIndex(index);
- Object temp = elementData[index];
- moveForwardElement(index);
- elementData[size--] = null;
- return temp;
- }
-
-
-
- @Override
- public int size() {
- return size;
- }
-
- @Override
- public Iterator iterator() {
- return new ArrayListIterator();
- }
-
- private class ArrayListIterator implements Iterator{
- private int i = 0;
- @Override
- public boolean hasNext() {
- return i < size;
- }
-
- @Override
- public Object next() {
- checkIndex(i);
- return elementData[i++];
- }
-
- }
-
- /**
- * 数组增长
- * @param newCapacity 新数组容量
- */
- private void grow(int newCapacity) {
- Object[] dest = new Object[newCapacity];
- System.arraycopy(elementData, 0, dest , 0, elementData.length);
- elementData = dest;
- }
-
- /**
- * 检查index index >=0 且 < size
- * @param index
- * @throws Exception
- */
- private void checkIndex(int index) {
- if(index < 0){
- throw new RuntimeException("index 必须大于0");
- }
- // 越界
- if(index >= size){
- throw new RuntimeException("index 必须小于size:" + size);
- }
- }
-
- /**
- * 检查数组容量是否已满,已满则扩容
- */
- private void checkArrayOutOfRange() {
- if(size >= elementData.length){
- // 扩容 默认新容量是原来容量的2倍
- grow(elementData.length * 2);
- }
- }
-
- /**
- * 后移元素,从index开始
- * @param index
- */
- private void moveBackwardElement(int index) {
- for (int i = size; i > index; i--) {
- elementData[i] = elementData[i - 1];
- }
- }
- /**
- * 前移元素,从index开始
- * @param index
- */
- private void moveForwardElement(int index) {
- for (int i = index; i < size; i++) {
- elementData[i] = elementData[i + 1];
- }
- }
-
-}
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/BinaryTreeNode.java b/group01/2137642225/work01/src/com/coding/mybasic/BinaryTreeNode.java
deleted file mode 100644
index 21bd8f696f..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/BinaryTreeNode.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.coding.mybasic;
-
-public class BinaryTreeNode {
-
- private Integer data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public Object getData() {
- return data;
- }
- public void setData(Integer 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;
- }
-
- public BinaryTreeNode insert(Integer o){
- if(o == null){
- throw new RuntimeException("不能插入空值");
- }
- BinaryTreeNode searchNode = search(this,o);
- if(isExistData(searchNode,o)){
- throw new RuntimeException("该值已存在 无法插入");
- }
- if(searchNode != null){
- BinaryTreeNode binaryTreeNode = new BinaryTreeNode();
- binaryTreeNode.setData(o);
- if(searchNode.data.intValue() > o.intValue()){
- searchNode.setLeft(binaryTreeNode);
- }else{
- searchNode.setRight(binaryTreeNode);
- }
- } else {
- throw new RuntimeException("根节点未赋值,无法插入");
- }
- return this;
- }
-
- private boolean isExistData(BinaryTreeNode searchNode,Integer data) {
- return searchNode != null && searchNode.data.intValue() == data.intValue();
-
- }
-
- private BinaryTreeNode search(BinaryTreeNode binaryTreeNode, Integer data) {
- if(binaryTreeNode == null || binaryTreeNode.data == null){
- return null;
- }
- Integer curNodeData = binaryTreeNode.data;
- if(curNodeData.intValue() > data.intValue()){// 左 curNodeData > data
- if(binaryTreeNode.left != null){
- return search(binaryTreeNode.left,data);
- }
- }else if(curNodeData.intValue() < data.intValue()){
- if(binaryTreeNode.right != null){
- return search(binaryTreeNode.right,data);
- }
-
- }
- return binaryTreeNode;
- }
-
-}
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/Iterator.java b/group01/2137642225/work01/src/com/coding/mybasic/Iterator.java
deleted file mode 100644
index 622cc5b902..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.coding.mybasic;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/LinkedList.java b/group01/2137642225/work01/src/com/coding/mybasic/LinkedList.java
deleted file mode 100644
index ab37360e78..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/LinkedList.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package com.coding.mybasic;
-
-public class LinkedList implements List {
-
- private Node head;
- private Node last;
- private int size;
-
- public LinkedList() {
- }
-
- @Override
- public void add(Object element) {
- if(head == null){
- addHead(element);
- }else{
- addLast(element);
- }
- }
-
- @Override
- public void add(int index, Object element) {
- if(index == size){
- add(element);
- return;
- }
-
- if(index == 0){
- addFirst(element);
- return;
- }
- checkIndex(index);
- insertElement(index - 1,element);
- }
-
-
- @Override
- public Object get(int index) {
- checkIndex(index);
- Node node = getNodeByIndex(index);
- return node != null ? node.data : null;
- }
-
- @Override
- public Object remove(int index) {
-
- checkIndex(index);
- Object element = null;
- if(index == 0){
- element = removeFirst();
- }
- else if(index == (size - 1)){
- element = removeLast();
- }
- else {
- element = removeMiddle(index);
- }
- return element;
- }
-
-
- @Override
- public int size() {
- return size;
- }
-
-
- @Override
- public Iterator iterator() {
- return new LinkedListIterator();
- }
-
- private class LinkedListIterator implements Iterator{
- private Node node = head;
- int i = 0;
- @Override
- public boolean hasNext() {
- return i < size;
- }
-
- @Override
- public Object next() {
- checkIndex(i);
- Object element = node.data;
- node = node.next;
- i++;
- return element;
- }
-
- }
-
- public void addFirst(Object o){
- Node node = new Node();
- node.data = o;
- node.next = head.next;
- head = node;
- size++;
- }
- public void addLast(Object o){
- Node node = new Node();
- node.data = o;
- node.next = null;
- last.next = node;
- last = node;
- size++;
- }
- public Object removeFirst(){
- return removeFirstNode();
- }
- public Object removeLast(){
- return removeLastNode();
- }
- private Object removeMiddle(int index) {
- Node temp = getNodeByIndex(index - 1);
- Node removeNode = temp.next;
- Object element = removeNode.data;
- temp.next = removeNode.next;
- removeNode = null;
- size--;
- return element;
- }
-
- /**
- * 检查index index >=0 且 < size
- * @param index
- * @throws Exception
- */
- private void checkIndex(int index) {
- if(index < 0){
- throw new RuntimeException("index 必须大于0");
- }
- // 越界
- if(index >= size){
- throw new RuntimeException("index 必须小于size:" + size);
- }
- }
-
- /**
- * 添加head
- * @param element
- */
- private void addHead(Object element) {
- head = new Node();
- head.data = element;
- head.next = null;
- last = head;
- size++;
- }
- /**
- * 插入序号在0-size之间的元素,不包含0和size位置
- * @param index
- * @param element
- */
- private void insertElement(int index, Object element) {
-
- Node temp = getNodeByIndex(index);
- if(temp != null){
- Node node = new Node();
- node.data = element;
- node.next = temp.next;
- temp.next = node;
- }
- size++;
- }
- /**
- * 获取下标为index的元素
- * @param index
- * @return
- */
- private Node getNodeByIndex(int index) {
- Node temp = head;
- int i = 0;
-
- while(i < size){
- if(i == index){
- return temp;
- }
- temp = temp.next;
- i++;
- }
-
- return null;
- }
- /**
- * 移除最后一个元素
- * @return
- */
- private Object removeLastNode() {
- Node node = getNodeByIndex(size - 2);
- Node lastNode = node.next;
- Object element = lastNode.data;
- lastNode = null;
- last = node;
- size--;
- return element;
- }
- /**
- * 移除第一个元素
- * @return
- */
- private Object removeFirstNode() {
- Node node = head.next;
- Object element = head.data;
- head = null;
- head = node;
- size--;
- return element;
- }
-
-
-
- private static class Node{
- Object data;
- Node next;
- public Node() {
- }
- @SuppressWarnings("unused")
- public Node(Object data, Node next) {
- super();
- this.data = data;
- this.next = next;
- }
-
-
- }
-}
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/List.java b/group01/2137642225/work01/src/com/coding/mybasic/List.java
deleted file mode 100644
index 87a58a6c4c..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/List.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.coding.mybasic;
-
-public interface List {
- public void add(Object element);
- public void add(int index, Object element);
- public Object get(int index);
- public Object remove(int index);
- public int size();
- public Iterator iterator();
-}
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/Queue.java b/group01/2137642225/work01/src/com/coding/mybasic/Queue.java
deleted file mode 100644
index 36d10fd668..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/Queue.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.coding.mybasic;
-
-public class Queue {
- private LinkedList linkedList = new LinkedList();
- public void enQueue(Object o){
- linkedList.add(o);
- }
-
- public Object deQueue(){
- checkEmptyQueue();
- return linkedList.remove(0);
- }
-
- public boolean isEmpty(){
- return size() <= 0;
- }
-
- public int size(){
- return linkedList.size();
- }
-
- /**
- * 检查队列是否为空
- */
- private void checkEmptyQueue() {
- if(isEmpty()){
- throw new RuntimeException("size:" + size() + " 空队列");
- }
- }
-}
diff --git a/group01/2137642225/work01/src/com/coding/mybasic/Stack.java b/group01/2137642225/work01/src/com/coding/mybasic/Stack.java
deleted file mode 100644
index f50e686317..0000000000
--- a/group01/2137642225/work01/src/com/coding/mybasic/Stack.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.coding.mybasic;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o){
- elementData.add(o);
- }
-
- public Object pop(){
- checkEmptyStack();
- return elementData.remove(size() - 1);
- }
-
- public Object peek(){
- checkEmptyStack();
- Object element = elementData.get(size() - 1);
- return element;
- }
-
- public boolean isEmpty(){
- return size() <= 0;
- }
- public int size(){
- return elementData.size();
- }
- /**
- * 检查栈是否为空
- */
- private void checkEmptyStack() {
- if(isEmpty()){
- throw new RuntimeException("size:" + size() + " 空栈");
- }
- }
-}
diff --git a/group01/2137642225/work01/src/com/coding/test/TestArrayList.java b/group01/2137642225/work01/src/com/coding/test/TestArrayList.java
deleted file mode 100644
index 8bd8952195..0000000000
--- a/group01/2137642225/work01/src/com/coding/test/TestArrayList.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.coding.test;
-
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.coding.mybasic.ArrayList;
-import com.coding.mybasic.Iterator;
-import com.coding.mybasic.List;
-
-public class TestArrayList {
-
- private List list;
- @Before
- public void before() {
- list = new ArrayList();
- }
-
- @Test
- public void testAddObject() {
- list.add("ele");
- Assert.assertEquals("ele", list.get(0));
- }
-
- @Test
- public void testAddIntObject() {
-
- for (int i = 0; i < 5; i++) {
- list.add(i,i);
- Assert.assertEquals(i, list.get(i));
- }
-
- }
-
- @Test
- public void testGet() {
- list.add("ss");
- Assert.assertEquals("ss", list.get(0));
- }
-
- @Test
- public void testRemove() {
- list.add("we");
- list.add(1, "gga");
- list.add(0, "start");
- list.add(3, "end");
-
- Assert.assertEquals("end", list.remove(3));
-
- }
-
- @Test
- public void testSize() {
-
- for (int i = 0; i < 10; i++) {
- list.add(i);
- }
-
- Assert.assertEquals(10, list.size());
- }
-
- @Test
- public void testIterator() {
-
- for (int i = 0; i < 10; i++) {
- list.add(i);
- }
- Iterator iterator = list.iterator();
- int i = 0;
- while(iterator.hasNext()){
- Assert.assertEquals(i++, iterator.next());
- }
- }
-
- @After
- public void after(){
-
- }
-}
diff --git a/group01/2137642225/work01/src/com/coding/test/TestBinaryTreeNode.java b/group01/2137642225/work01/src/com/coding/test/TestBinaryTreeNode.java
deleted file mode 100644
index 662bb55570..0000000000
--- a/group01/2137642225/work01/src/com/coding/test/TestBinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.coding.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.coding.mybasic.BinaryTreeNode;
-
-public class TestBinaryTreeNode {
-
- private BinaryTreeNode node;
- @Before
- public void before(){
- node = new BinaryTreeNode();
- }
-
- @Test
- public void testInsert() {
- node.insert(1);
- node.insert(0);
- node.insert(3);
- node.insert(-2);
- node.insert(-1);
- assertEquals(1, node.getData());
- assertEquals(0, node.getLeft().getData());
- assertEquals(3, node.getRight().getData());
- assertEquals(-2, node.getLeft().getLeft().getData());
- assertEquals(-1, node.getLeft().getLeft().getRight().getData());
- }
-
-}
diff --git a/group01/2137642225/work01/src/com/coding/test/TestLinkedList.java b/group01/2137642225/work01/src/com/coding/test/TestLinkedList.java
deleted file mode 100644
index 57a8b13bb8..0000000000
--- a/group01/2137642225/work01/src/com/coding/test/TestLinkedList.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.coding.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.coding.mybasic.Iterator;
-import com.coding.mybasic.LinkedList;
-import com.coding.mybasic.List;
-
-public class TestLinkedList {
-
- private List list;
-
- @Before
- public void before(){
- list = new LinkedList();
- }
-
- @Test
- public void testAddObject() {
- list.add(1);
-
- System.out.println(list.get(0));
- assertEquals(1, list.get(0));
- assertEquals(1, list.size());
- }
-
- @Test
- public void testAddIntObject() {
- list.add(0,1);
- System.out.println(list.get(0));
- assertEquals(1, list.get(0));
- assertEquals(1, list.size());
- }
-
- @Test
- public void testGet() {
- fail("Not yet implemented");
- }
-
- @Test
- public void testRemove() {
- list.add(0,1);
- System.out.println(list.remove(0));
- assertEquals(0, list.size());
- }
-
- @Test
- public void testSize() {
-
- for(int i = 0; i < 10; i++){
- list.add(i, i);
- }
-
- assertEquals(10, list.size());
- }
-
- @Test
- public void testIterator() {
-
- for(int i = 0; i < 10; i++){
- list.add(i, i);
- }
- Iterator iterator = list.iterator();
- int i = 0;
- while(iterator.hasNext()){
- assertEquals(i++, iterator.next());
- }
- //iterator.next();
- }
-}
diff --git a/group01/2137642225/work01/src/com/coding/test/TestQueue.java b/group01/2137642225/work01/src/com/coding/test/TestQueue.java
deleted file mode 100644
index 367a44d151..0000000000
--- a/group01/2137642225/work01/src/com/coding/test/TestQueue.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.coding.test;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.coding.mybasic.Queue;
-
-public class TestQueue {
-
- private Queue queue;
- @Before
- public void before(){
- queue = new Queue();
- queue.enQueue(1);
- queue.enQueue(2);
- }
- @Test
- public void testEnQueue() {
- queue.enQueue(3);
- assertEquals(3, queue.size());
- }
-
- @Test
- public void testDeQueue() {
- assertEquals(2, queue.deQueue());
- assertEquals(1, queue.deQueue());
- }
-
- @Test
- public void testSize() {
- assertEquals(2, queue.size());
- }
-
-}
diff --git a/group01/2137642225/work01/src/com/coding/test/TestStack.java b/group01/2137642225/work01/src/com/coding/test/TestStack.java
deleted file mode 100644
index 0e278f2992..0000000000
--- a/group01/2137642225/work01/src/com/coding/test/TestStack.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.coding.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.coding.mybasic.Stack;
-
-public class TestStack {
-
- private Stack stack;
- @Before
- public void before() {
- stack = new Stack();
- stack.push(1);
- stack.push(2);
- stack.push(3);
- }
-
- @Test
- public void testPush() {
- assertEquals(3, stack.peek());
- }
-
- @Test
- public void testPop() {
- assertEquals(3, stack.pop());
- assertEquals(2, stack.pop());
- assertEquals(1, stack.pop());
- //stack.pop();
- //System.out.println(stack.size());
- }
-
- @Test
- public void testPeek() {
- assertEquals(3, stack.peek());
- assertEquals(3, stack.pop());
- assertEquals(2, stack.pop());
- //assertEquals(1, stack.pop());
- assertEquals(1, stack.peek());
- }
-
- @Test
- public void testSize() {
- assertEquals(3, stack.size());
- }
-
-}
diff --git a/group01/275150374/275150374Learning/.idea/compiler.xml b/group01/275150374/275150374Learning/.idea/compiler.xml
deleted file mode 100644
index 217af471a9..0000000000
--- a/group01/275150374/275150374Learning/.idea/compiler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/group01/275150374/275150374Learning/.idea/description.html b/group01/275150374/275150374Learning/.idea/description.html
deleted file mode 100644
index db5f129556..0000000000
--- a/group01/275150374/275150374Learning/.idea/description.html
+++ /dev/null
@@ -1 +0,0 @@
-Simple Java application that includes a class with main()
method
\ No newline at end of file
diff --git a/group01/275150374/275150374Learning/.idea/encodings.xml b/group01/275150374/275150374Learning/.idea/encodings.xml
deleted file mode 100644
index e206d70d85..0000000000
--- a/group01/275150374/275150374Learning/.idea/encodings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/group01/275150374/275150374Learning/.idea/misc.xml b/group01/275150374/275150374Learning/.idea/misc.xml
deleted file mode 100644
index de8f7c75a3..0000000000
--- a/group01/275150374/275150374Learning/.idea/misc.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/group01/275150374/275150374Learning/.idea/modules.xml b/group01/275150374/275150374Learning/.idea/modules.xml
deleted file mode 100644
index 5534fceb30..0000000000
--- a/group01/275150374/275150374Learning/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/group01/275150374/275150374Learning/.idea/vcs.xml b/group01/275150374/275150374Learning/.idea/vcs.xml
deleted file mode 100644
index c2365ab11f..0000000000
--- a/group01/275150374/275150374Learning/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/group01/275150374/275150374Learning/275150374Learning.iml b/group01/275150374/275150374Learning/275150374Learning.iml
deleted file mode 100644
index d5c0743275..0000000000
--- a/group01/275150374/275150374Learning/275150374Learning.iml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/group01/275150374/275150374Learning/src/task01/ArrayList.java b/group01/275150374/275150374Learning/src/task01/ArrayList.java
deleted file mode 100644
index 8d604f109e..0000000000
--- a/group01/275150374/275150374Learning/src/task01/ArrayList.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package task01;
-
-import java.util.Arrays;
-
-/**第一周作业
- * 自己实现一个 ArrayList
- * Created by eurry on 2017/2/26.
- */
-public class ArrayList {
- /**
- * ArrayList的长度
- */
- private int size = 0;
-
- private Object[] elementData = {};
-
- public void add(Object o){
- elementData = Arrays.copyOf(elementData, size+1);
- elementData[size] = o;
- size++;
- }
-
- public void add(int index, Object o){
- if(index < size){
- elementData = Arrays.copyOf(elementData, size+1);
- System.arraycopy(elementData, index, elementData, index+1, size-index);
- elementData[index] = o;
- size++;
- }else{
- elementData = Arrays.copyOf(elementData, index+1);
- elementData[index] = o;
- size = index+1;
- }
- }
-
- public Object get(int index){
- if(index < size){
- return elementData[index];
- }else{
- throw new IndexOutOfBoundsException("导致对数组范围以外的数据的访问");
- }
- }
-
- public Object remove(int index){
- if(index < size){
- Object re = elementData[index];
- System.arraycopy(elementData, index+1, elementData, index, size-index-1);
- elementData = Arrays.copyOf(elementData, size-1);
- size--;
- return re;
- }else{
- throw new IndexOutOfBoundsException("导致对数组范围以外的数据的访问");
- }
- }
-
- public int size(){
- return size;
- }
-
- public String toString(){
- String str = null;
- if(elementData.length > 0){
- str = "";
- for (Object anElementData : elementData) {
- str += anElementData.toString() + ",";
- }
- str = str.substring(0, str.length()-1);
- }
- return str;
- }
-
- /**
- * 测试
- */
- public static void main(String[] str){
- ArrayList list = new ArrayList();
- list.add("A");
- list.add("B");
- list.add(1, "C");
- list.add("D");
- Object d = list.get(3);
- Object dd = list.remove(3);
- System.out.println(list.size());
- System.out.println(list.toString());
- }
-}
diff --git a/group01/275150374/275150374Learning/src/task01/LinkedList.java b/group01/275150374/275150374Learning/src/task01/LinkedList.java
deleted file mode 100644
index 23eb1adaae..0000000000
--- a/group01/275150374/275150374Learning/src/task01/LinkedList.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package task01;
-
-import java.util.Arrays;
-
-/**第一周作业
- * 自己实现一个 LinkedList
- * Created by eurry on 2017/2/26.
- */
-public class LinkedList {
-
- private int size = 0;
- private Node head=null;
-
- public void add(Object o){
- if(size == 0){
- head = new Node(o);
- }else{
- Node next = head;
- while(next.next != null){
- next = next.next;
- }
- next.next = new Node(o);
- }
- size++;
- }
-
- public void add(int index, Object o){
- if(index <= size){
- if(size == 0){
- add(o);
- }else{
- if(index==0){
- addFirst(o);
- }else if(index==size){
- add(o);
- }else{
- Node next = head;
- for(int i=0; i 0){
- Node ele = null;
- Node next = head;
- for(int i=0; i
-
-
- root
- com.coding2017
- 1.0-SNAPSHOT
-
- 4.0.0
-
- basic
-
-
-
-
- junit
- junit
-
-
- junit
- junit-dep
-
-
-
-
-
\ No newline at end of file
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/ArrayList.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/ArrayList.java
deleted file mode 100644
index a4199bdbdb..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/ArrayList.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.coding2017.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[4];
-
- public void add(Object o) {
- if (noSpace()) {
- extendSpace();
- }
-
- elementData[size++] = o;
- }
-
- private void extendSpace() {
- elementData = Arrays.copyOf(elementData, elementData.length * 2);
- }
-
- private boolean noSpace() {
- return size == elementData.length;
- }
-
- public void add(int index, Object o) {
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- }
- if (noSpace()) {
- extendSpace();
- }
-
- if (index == size) {
- add(o);
- return;
- }
-
- System.arraycopy(elementData, index, elementData, index + 1, size - index);
- elementData[index] = o;
- size++;
- }
-
- public Object get(int index) {
- if (index < 0 || index >= size) {
- throw new IndexOutOfBoundsException();
- }
- return elementData[index];
- }
-
- public Object remove(int index) {
- if (index < 0 || index >= size) {
- throw new IndexOutOfBoundsException();
- }
- if (index == size - 1) {
- return elementData[--size];
- }
-
- Object removed = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
- size--;
- return removed;
- }
-
- public int size() {
- return size;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- if (size > 0) {
- builder.append(get(0));
- }
- for (int i = 1; i < size; i++) {
- builder.append(", ").append(get(i));
- }
- builder.append("]");
- return builder.toString();
- }
-
- public Iterator iterator() {
- return new ArrayListIterator();
- }
-
- private class ArrayListIterator implements Iterator {
- private int pos;
-
- @Override
- public boolean hasNext() {
- return pos < size();
- }
-
- @Override
- public Object next() {
- return ArrayList.this.get(pos++);
- }
- }
-}
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/BinaryTreeNode.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/BinaryTreeNode.java
deleted file mode 100644
index acf4798b9e..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.coding2017.basic;
-
-public class BinaryTreeNode {
-
- private Integer data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode insert(Integer o) {
- if (o <= data) {
- if (left == null) {
- left = new BinaryTreeNode(o);
- return left;
- }
- return left.insert(o);
- } else {
- if (right == null) {
- right = new BinaryTreeNode(o);
- return right;
- }
- return right.insert(o);
- }
- }
-
- public BinaryTreeNode(Integer data) {
- this.data = data;
- }
-
- public Integer getData() {
- return data;
- }
-
- public void setData(Integer 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;
- }
-
- @Override
- public String toString() {
- return data + " " + left + " " + right;
- }
-}
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/Iterator.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/Iterator.java
deleted file mode 100644
index 19e214cfbb..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.coding2017.basic;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/LinkedList.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/LinkedList.java
deleted file mode 100644
index 5aeeb7c7f8..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/LinkedList.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package com.coding2017.basic;
-
-public class LinkedList implements List {
-
- private Node head;
-
- private Node tail;
-
- private int size;
-
- public void add(Object o) {
- addLast(o);
- }
-
- public void add(int index, Object o) {
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- }
- if (index == size) {
- addLast(o);
- } else if (index == 0) {
- addFirst(o);
- } else {
- Node node = new Node(o);
- Node prevNode = getNode(index - 1);
- Node nextNode = prevNode.next;
- prevNode.next = node;
- node.prev = prevNode;
- nextNode.prev = node;
- node.next = nextNode;
- size++;
- }
- }
-
- private Node getNode(int index) {
- if (index < 0 || index >= size) {
- throw new IndexOutOfBoundsException();
- }
- Node node = head;
- for (int j = 0; j < index; j++) {
- node = node.next;
- }
- return node;
- }
-
- public Object get(int index) {
- if (index < 0 || index >= size) {
- throw new IndexOutOfBoundsException();
- }
- return getNode(index).data;
- }
-
- public Object remove(int index) {
- if (index < 0 || index >= size) {
- throw new IndexOutOfBoundsException();
- }
-
- if (index == 0) {
- return removeFirst();
- } else if (index == size - 1) {
- return removeLast();
- } else {
- Node node = getNode(index);
- node.prev.next = node.next;
- node.next.prev = node.prev;
- size--;
- return node.data;
- }
- }
-
- public int size() {
- return size;
- }
-
- public void addFirst(Object o) {
- Node node = new Node(o);
- if (size == 0) {
- head = node;
- tail = node;
- } else {
- head.prev = node;
- node.next = head;
- head = node;
- }
- size++;
- }
-
- public void addLast(Object o) {
- if (size == 0) {
- addFirst(o);
- } else {
- Node node = new Node(o);
- tail.next = node;
- node.prev = tail;
- tail = node;
- size++;
- }
- }
-
- public Object removeFirst() {
- if (size == 0) {
- throw new IndexOutOfBoundsException();
- }
- Node node = head;
- if (size == 1) {
- head = null;
- tail = null;
- size--;
- } else {
- head.next.prev = null;
- head = head.next;
- size--;
- }
- return node.data;
- }
-
- public Object removeLast() {
- if (size == 0) {
- throw new IndexOutOfBoundsException();
- }
- if (size == 1) {
- return removeFirst();
- }
- Node node = tail;
- tail.prev.next = null;
- tail = tail.prev;
- size--;
- return node.data;
- }
-
- public Iterator iterator() {
- return new LinkedListIterator();
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- if (size > 0) {
- builder.append(get(0));
- }
- for(Node node = head.next; node != null; node = node.next) {
- builder.append(", ").append(node.data);
- }
- builder.append("]");
- return builder.toString();
- }
-
- private static class Node {
- private Object data;
- private Node next;
- private Node prev;
-
- public Node() {}
-
- private Node(Object data) {
- this.data = data;
- }
- }
-
- private class LinkedListIterator implements Iterator {
- private Node node;
-
- public LinkedListIterator() {
- this.node = LinkedList.this.head;
- }
-
- @Override
- public boolean hasNext() {
- return node != null;
- }
-
- @Override
- public Object next() {
- Node temp = node;
- node = node.next;
- return temp.data;
- }
- }
-}
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/List.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/List.java
deleted file mode 100644
index 0fee4d7a42..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/List.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.coding2017.basic;
-
-public interface List {
- void add(Object o);
-
- void add(int index, Object o);
-
- Object get(int index);
-
- Object remove(int index);
-
- int size();
-}
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/Queue.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/Queue.java
deleted file mode 100644
index f611b874e0..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/Queue.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.coding2017.basic;
-
-public class Queue {
-
- LinkedList list = new LinkedList();
-
- public void enQueue(Object o) {
- list.addLast(o);
- }
-
- public Object deQueue() {
- return list.removeFirst();
- }
-
- public boolean isEmpty() {
- return list.size() == 0;
- }
-
- public int size() {
- return list.size();
- }
-}
diff --git a/group01/280646174/basic/src/main/java/com/coding2017/basic/Stack.java b/group01/280646174/basic/src/main/java/com/coding2017/basic/Stack.java
deleted file mode 100644
index 3ec7b5788b..0000000000
--- a/group01/280646174/basic/src/main/java/com/coding2017/basic/Stack.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.coding2017.basic;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o) {
- elementData.add(o);
- }
-
- public Object pop() {
- return elementData.remove(elementData.size() - 1);
- }
-
- public Object peek() {
- return elementData.get(elementData.size() - 1);
- }
-
- public boolean isEmpty() {
- return elementData.size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-}
diff --git a/group01/280646174/basic/src/test/java/com/coding2017/basic/ArrayListTest.java b/group01/280646174/basic/src/test/java/com/coding2017/basic/ArrayListTest.java
deleted file mode 100644
index 21e9d59694..0000000000
--- a/group01/280646174/basic/src/test/java/com/coding2017/basic/ArrayListTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.coding2017.basic;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Created by kaitao.li on 17/2/21.
- */
-public class ArrayListTest {
- @Test
- public void testAdd() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- Assert.assertTrue(arrayList.get(0).equals("0"));
- }
-
- @Test
- public void testAddWithIndex() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- arrayList.add(1, "2");
- Assert.assertTrue(arrayList.get(1).equals("2"));
- Assert.assertTrue(arrayList.get(2).equals("1"));
- Assert.assertTrue(arrayList.size() == 3);
- }
-
- @Test
- public void get() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- Assert.assertTrue(arrayList.get(1).equals("1"));
- }
-
- @Test
- public void remove() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- arrayList.add("2");
- Object remove = arrayList.remove(1);
- Assert.assertTrue(remove.equals("1"));
- Assert.assertTrue(arrayList.size() == 2);
- }
-
- @Test
- public void size() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- Assert.assertEquals(arrayList.size(), 2);
- }
-
- @Test
- public void testExtend() {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- arrayList.add("2");
- arrayList.add("3");
- arrayList.add("4");
- Assert.assertTrue(arrayList.get(4).equals("4"));
- }
-
- @Test
- public void iterator() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- Iterator iterator = arrayList.iterator();
- Assert.assertTrue(iterator.hasNext());
- Assert.assertTrue(iterator.next().equals("0"));
- Assert.assertTrue(iterator.hasNext());
- Assert.assertTrue(iterator.next().equals("1"));
- Assert.assertTrue(!iterator.hasNext());
- }
-
-}
\ No newline at end of file
diff --git a/group01/280646174/basic/src/test/java/com/coding2017/basic/BinaryTreeNodeTest.java b/group01/280646174/basic/src/test/java/com/coding2017/basic/BinaryTreeNodeTest.java
deleted file mode 100644
index 3a9877c596..0000000000
--- a/group01/280646174/basic/src/test/java/com/coding2017/basic/BinaryTreeNodeTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.coding2017.basic;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by kaitao.li on 17/2/24.
- */
-public class BinaryTreeNodeTest {
-
- @Test
- public void insert() throws Exception {
- BinaryTreeNode binaryTreeNode = new BinaryTreeNode(5);
- binaryTreeNode.insert(4);
- binaryTreeNode.insert(6);
- binaryTreeNode.insert(5);
- assertTrue(binaryTreeNode.getLeft().getData() == 4);
- assertTrue(binaryTreeNode.getRight().getData() == 6);
- assertTrue(binaryTreeNode.getLeft().getRight().getData() == 5);
- System.out.println(binaryTreeNode);
- }
-
-}
\ No newline at end of file
diff --git a/group01/280646174/basic/src/test/java/com/coding2017/basic/LinkedListTest.java b/group01/280646174/basic/src/test/java/com/coding2017/basic/LinkedListTest.java
deleted file mode 100644
index f6855d3583..0000000000
--- a/group01/280646174/basic/src/test/java/com/coding2017/basic/LinkedListTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.coding2017.basic;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by kaitao.li on 17/2/21.
- */
-public class LinkedListTest {
- @Test
- public void testAdd() throws Exception {
- LinkedList list = new LinkedList();
- list.add("0");
- Assert.assertTrue(list.get(0).equals("0"));
- }
-
- @Test
- public void testAddWithIndex() throws Exception {
- LinkedList list = new LinkedList();
- list.add("0");
- list.add("1");
- list.add(1, "2");
- Assert.assertTrue(list.get(1).equals("2"));
- Assert.assertTrue(list.get(2).equals("1"));
- Assert.assertTrue(list.size() == 3);
- }
-
- @Test
- public void get() throws Exception {
- LinkedList list = new LinkedList();
- list.add("0");
- list.add("1");
- Assert.assertTrue(list.get(1).equals("1"));
- }
-
- @Test
- public void remove() throws Exception {
- LinkedList list = new LinkedList();
- list.add("0");
- list.add("1");
- list.add("2");
- Object remove = list.remove(1);
- Assert.assertTrue(remove.equals("1"));
- Assert.assertTrue(list.size() == 2);
- }
-
- @Test
- public void size() throws Exception {
- LinkedList list = new LinkedList();
- list.add("0");
- list.add("1");
- Assert.assertEquals(list.size(), 2);
- }
-
- @Test
- public void testAddFirst() {
- LinkedList list = new LinkedList();
- list.addFirst("0");
- Assert.assertTrue(list.get(0).equals("0"));
- list.addFirst("1");
- Assert.assertTrue(list.get(0).equals("1"));
- list.removeFirst();
- Assert.assertTrue(list.get(0).equals("0"));
- list.removeLast();
- Assert.assertTrue(list.size() == 0);
- }
-
- @Test
- public void iterator() throws Exception {
- ArrayList arrayList = new ArrayList();
- arrayList.add("0");
- arrayList.add("1");
- Iterator iterator = arrayList.iterator();
- Assert.assertTrue(iterator.hasNext());
- Assert.assertTrue(iterator.next().equals("0"));
- Assert.assertTrue(iterator.hasNext());
- Assert.assertTrue(iterator.next().equals("1"));
- Assert.assertTrue(!iterator.hasNext());
- }
-
-}
\ No newline at end of file
diff --git a/group01/280646174/basic/src/test/java/com/coding2017/basic/QueueTest.java b/group01/280646174/basic/src/test/java/com/coding2017/basic/QueueTest.java
deleted file mode 100644
index 5fde883433..0000000000
--- a/group01/280646174/basic/src/test/java/com/coding2017/basic/QueueTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.coding2017.basic;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by kaitao.li on 17/2/21.
- */
-public class QueueTest {
- @Test
- public void enQueue() throws Exception {
- Queue queue = new Queue();
- queue.enQueue(1);
- queue.enQueue(2);
- Assert.assertTrue(queue.size() == 2);
- Assert.assertTrue(queue.deQueue().equals(1));
- Assert.assertTrue(queue.deQueue().equals(2));
- Assert.assertTrue(queue.isEmpty());
- }
-
-}
\ No newline at end of file
diff --git a/group01/280646174/basic/src/test/java/com/coding2017/basic/StackTest.java b/group01/280646174/basic/src/test/java/com/coding2017/basic/StackTest.java
deleted file mode 100644
index 145d22d371..0000000000
--- a/group01/280646174/basic/src/test/java/com/coding2017/basic/StackTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.coding2017.basic;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by kaitao.li on 17/2/21.
- */
-public class StackTest {
- @Test
- public void push() throws Exception {
- Stack stack = new Stack();
- stack.push(1);
- stack.push(2);
- Assert.assertTrue(stack.size() == 2);
- Assert.assertTrue(stack.peek().equals(2));
- Assert.assertTrue(stack.pop().equals(2));
- Assert.assertTrue(stack.pop().equals(1));
- Assert.assertTrue(stack.isEmpty());
- }
-
-}
\ No newline at end of file
diff --git a/group01/280646174/pom.xml b/group01/280646174/pom.xml
deleted file mode 100644
index c99644072b..0000000000
--- a/group01/280646174/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
- 4.0.0
-
- com.coding2017
- root
- pom
- 1.0-SNAPSHOT
-
- basic
-
-
-
- 4.12
- 4.11
-
-
-
-
-
-
- junit
- junit
- ${junit.junit.version}
- test
-
-
- junit
- junit-dep
- ${junit.junit-dep.version}
- test
-
-
-
-
-
\ No newline at end of file
diff --git a/group01/349209948/.gitignore b/group01/349209948/.gitignore
deleted file mode 100644
index b3d8633e2b..0000000000
--- a/group01/349209948/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/bin/
-*.project
-*.classpath
\ No newline at end of file
diff --git a/group01/349209948/src/week1_0226/ArrayList.java b/group01/349209948/src/week1_0226/ArrayList.java
deleted file mode 100644
index 57d25187f8..0000000000
--- a/group01/349209948/src/week1_0226/ArrayList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package week1_0226;
-import java.util.Arrays;
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
- ensureCapacity(size + 1);
- elementData[size++] = o;
- }
- private void ensureCapacity(int size){
- if (size > elementData.length){
- grow();
- }
- }
- private void grow(){
- elementData = Arrays.copyOf(elementData, size * 2);
- }
- public void add(int index, Object o){
- rangeCheckForAdd(index);
- ensureCapacity(size + 1);
- System.arraycopy(elementData,index, elementData, index + 1, size - index);
- elementData[index] = o;
- size ++;
- }
- private void rangeCheckForAdd(int index){
- //index = size时不需要报错?
- if (index > size || index < 0){
- throw new IndexOutOfBoundsException();
- }
- }
- public Object get(int index){
- rangeCheck(index);
- return elementData[index];
- }
- private void rangeCheck(int index){
- if (index >= size || index < 0){
- throw new IndexOutOfBoundsException();
- }
- }
-
- public Object remove(int index){
- rangeCheck(index);
- Object dest = elementData[index];
- System.arraycopy(elementData, index +1, elementData, index, size-index-1);
- size --;
- return dest;
- }
-
- public int size(){
- return size;
- }
-
- public Iterator iterator(){
- return new Iterator(){
- private int index = 0;
- public Object next(){
- return elementData[index++];
- }
- public boolean hasNext(){
- return index >= size;
- }
- };
- }
-
-}
diff --git a/group01/349209948/src/week1_0226/BinaryTreeNode.java b/group01/349209948/src/week1_0226/BinaryTreeNode.java
deleted file mode 100644
index e667bdf15a..0000000000
--- a/group01/349209948/src/week1_0226/BinaryTreeNode.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package week1_0226;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(Object o){
- this.data = o;
- }
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- BinaryTreeNode node = new BinaryTreeNode(o);
- this.setRight(node);
- return node;
- }
-
-}
diff --git a/group01/349209948/src/week1_0226/Iterator.java b/group01/349209948/src/week1_0226/Iterator.java
deleted file mode 100644
index 3eddc2b726..0000000000
--- a/group01/349209948/src/week1_0226/Iterator.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package week1_0226;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-}
diff --git a/group01/349209948/src/week1_0226/LinkedList.java b/group01/349209948/src/week1_0226/LinkedList.java
deleted file mode 100644
index 51c9ab8844..0000000000
--- a/group01/349209948/src/week1_0226/LinkedList.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package week1_0226;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-
- private Node head;
- private int size = 0;
-
- public void add(Object o){
- if (head == null) {
- head = new Node(o);
- } else {
- //遍历到链表的尾部
- Node tail = head;
- while (tail.next != null) {
- tail = tail.next;
- }
- Node node = new Node(o);
- tail.next = node;
- }
- size ++;
- }
- public void add(int index , Object o){
- rangeCheckForAdd(index);
- if (index ==0) {
- Node node = new Node(o);
- node.next = head;
- head = node;
- } else {
- Node preHead = head;
- for (int i = 0; i < index -1; i ++){
- preHead = head.next;
- }
- Node node = new Node(o);
- node.next = preHead.next;
- preHead.next = node;
- }
- }
- public Object get(int index){
- rangeCheck(index);
- Node dest = head;
- for (int i = 0; i< index; i++){
- dest = dest.next;
- }
- return dest.data;
- }
- private void rangeCheck(int index){
- if (index >= size || index <0){
- throw new IndexOutOfBoundsException();
- }
- }
- public Object remove(int index){
- rangeCheck(index);
- Node preDest = head;
- for (int i = 0; i < index; i++){
- preDest = preDest.next;
- }
- Node dest = preDest.next;
- preDest.next = dest.next;
- size --;
- return dest;
- }
-
- public int size(){
- return size;
- }
-
- public void addFirst(Object o){
- Node node = new Node(o);
- node.next = head;
- head = node;
- size ++;
- }
- public void addLast(Object o){
- Node lastNode = head;
- while (lastNode.next != null){
- lastNode = lastNode.next;
- }
- Node node = new Node(o);
- lastNode.next = node;
- size++;
- }
- public Object removeFirst(){
- if (head == null) {
- throw new NoSuchElementException();
- }
- Node headTmp = head;
- head = head.next;
- size --;
- return headTmp;
- }
- public Object removeLast(){
- if (head == null) {
- throw new NoSuchElementException();
- }
- if (head.next == null) {
- Node dest = head;
- head = null;
- size --;
- return dest;
- }
- Node preLastNode = head;
- while(preLastNode.next.next != null) {
- preLastNode = preLastNode.next;
- }
- Node dest = preLastNode.next;
- preLastNode.next = null;
- size --;
- return dest;
- }
- public Iterator iterator(){
- return null;
- }
- private void rangeCheckForAdd(int index){
- if (index > size || index <0){
- throw new IndexOutOfBoundsException();
- }
- }
-
- private static class Node{
- Object data;
- Node next;
- Node (Object data) {
- this.data = data;
- next = null;
- }
- }
-}
diff --git a/group01/349209948/src/week1_0226/List.java b/group01/349209948/src/week1_0226/List.java
deleted file mode 100644
index ba1577cfaa..0000000000
--- a/group01/349209948/src/week1_0226/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package week1_0226;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-}
diff --git a/group01/349209948/src/week1_0226/Queue.java b/group01/349209948/src/week1_0226/Queue.java
deleted file mode 100644
index a20d6a303e..0000000000
--- a/group01/349209948/src/week1_0226/Queue.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package week1_0226;
-
-public class Queue {
-
- private LinkedList list = new LinkedList();
- public void enQueue(Object o){
- list.add(o);
- }
-
- public Object deQueue(){
- return list.removeFirst();
- }
-
- public boolean isEmpty(){
- return list.size() == 0;
- }
-
- public int size(){
- return list.size();
- }
-}
diff --git a/group01/349209948/src/week1_0226/Stack.java b/group01/349209948/src/week1_0226/Stack.java
deleted file mode 100644
index f5d6add66d..0000000000
--- a/group01/349209948/src/week1_0226/Stack.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package week1_0226;
-import java.util.EmptyStackException;
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o){
- elementData.add(o);
- }
-
- public Object pop(){
- checkStack();
- return elementData.remove(elementData.size() - 1);
- }
- private void checkStack(){
- if (elementData.size() == 0){
- throw new EmptyStackException();
- }
- }
- public Object peek(){
- checkStack();
- return elementData.get(elementData.size() - 1);
- }
- public boolean isEmpty(){
- return elementData.size() == 0;
- }
- public int size(){
- return elementData.size();
- }
-}
diff --git a/group01/360176196/.classpath b/group01/360176196/.classpath
deleted file mode 100644
index fb5011632c..0000000000
--- a/group01/360176196/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/group01/360176196/.gitignore b/group01/360176196/.gitignore
deleted file mode 100644
index 5e56e040ec..0000000000
--- a/group01/360176196/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin
diff --git a/group01/360176196/.project b/group01/360176196/.project
deleted file mode 100644
index a895f05a76..0000000000
--- a/group01/360176196/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- xqfGit
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/360176196/src/xqfGit/dataStructure/ArrayList.java b/group01/360176196/src/xqfGit/dataStructure/ArrayList.java
deleted file mode 100644
index 5996182fbe..0000000000
--- a/group01/360176196/src/xqfGit/dataStructure/ArrayList.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package xqfGit.dataStructure;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
-
- public void add(Object o){
- if(this.size >= elementData.length){
- elementData = Arrays.copyOf(elementData, size+1);
- elementData[size] = o;
- size++;
- }
- else{
- elementData[size-1] = o;
- size++;
- }
-
- }
-
- public void add(int index, Object o){
- if(index<0 || index>elementData.length){
- throw new ArrayIndexOutOfBoundsException("OutOfBounds");
- }
- else{
- System.arraycopy(elementData, index, elementData, index+1, elementData.length+1);
- elementData[index] = o;
- size++;
- }
- }
-
-
- public Object get(int index){
- if(index<0 || index>elementData.length){
- throw new ArrayIndexOutOfBoundsException("OutOfBounds");
- }
- else{
- return elementData[index];
- }
- }
-
-
- public Object remove(int index){
- if(index<0 || index>elementData.length){
- throw new ArrayIndexOutOfBoundsException("OutOfBounds");
- }
- else{
- Object reObject = elementData[index];
- System.arraycopy(elementData, index+1, elementData, index, elementData.length-1);
- size--;
- return reObject;
- }
- }
-
- public int size(){
- if(this.size < elementData.length){
- return size;
- }else{
- elementData = Arrays.copyOf(elementData, size);
- return size;
- }
- }
-
-
- public Iterator iterator(){
- return null;
- }
-
-}
diff --git a/group01/360176196/src/xqfGit/dataStructure/BinaryTreeNode.java b/group01/360176196/src/xqfGit/dataStructure/BinaryTreeNode.java
deleted file mode 100644
index 7662484884..0000000000
--- a/group01/360176196/src/xqfGit/dataStructure/BinaryTreeNode.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package xqfGit.dataStructure;
-
-import com.sun.swing.internal.plaf.basic.resources.basic;
-
-public class BinaryTreeNode {
-
- private Integer data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
-
-
-
- public Integer getData() {
- return data;
- }
- public void setData(Integer 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;
- }
-
- public BinaryTreeNode insert(Integer i){
-
- return null;
- }
-
- public BinaryTreeNode (){
-
- }
-
-
-
- public BinaryTreeNode(BinaryTreeNode b1,BinaryTreeNode b2){
- this.left = b1;
- this.right = b2;
- }
-
-}
diff --git a/group01/360176196/src/xqfGit/dataStructure/Iterator.java b/group01/360176196/src/xqfGit/dataStructure/Iterator.java
deleted file mode 100644
index ee4842739f..0000000000
--- a/group01/360176196/src/xqfGit/dataStructure/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package xqfGit.dataStructure;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/360176196/src/xqfGit/dataStructure/LinkedList.java b/group01/360176196/src/xqfGit/dataStructure/LinkedList.java
deleted file mode 100644
index a663f85b15..0000000000
--- a/group01/360176196/src/xqfGit/dataStructure/LinkedList.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package xqfGit.dataStructure;
-
-public class LinkedList implements List {
-
- private Node first;
- private Node last;
- private int size;
-
- public void add(Object o){
- Node l = new Node(o);
- l = last.next;
- size++;
- }
-
- public void add(int index , Object o){
- Node l = new Node(o);
- Node n = first;
- if(size == index){
- l = last.next;
- l = last;
- size++;
- }else{
- Node m = first;
- for(int i =0;i
-
-
-
-
-
diff --git a/group01/378213871/.gitignore b/group01/378213871/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group01/378213871/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group01/378213871/.project b/group01/378213871/.project
deleted file mode 100644
index a6666f301e..0000000000
--- a/group01/378213871/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- coding
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/378213871/src/com/coding/basic/week01/ArrayList.java b/group01/378213871/src/com/coding/basic/week01/ArrayList.java
deleted file mode 100644
index 5745209a08..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/ArrayList.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.coding.basic.week01;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
- ensureCapacity(size + 1);
- elementData[size++] = o;
- }
-
- public void ensureCapacity(int size) {
- if (size > elementData.length) {
- grow();
- }
- }
-
- public void grow() {
- elementData = Arrays.copyOf(elementData, size * 2);
- }
-
- public void add(int index, Object o){
- if (index < 0 || index >= size) {
- throw new ArrayIndexOutOfBoundsException();
- }
- ensureCapacity(size + 1);
- System.arraycopy(elementData, index, elementData, index + 1, size - index);
- elementData[index] = o;
- size++;
- }
-
- public Object get(int index){
- if (index < 0 || index >= size) {
- throw new ArrayIndexOutOfBoundsException();
- }
- return elementData[index];
- }
-
- public Object remove(int index){
- if (index < 0 || index >= size) {
- throw new ArrayIndexOutOfBoundsException();
- }
- Object removedItem = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
- size--;
- return removedItem;
- }
-
- public int size(){
- return size;
- }
-
- public Iterator iterator(){
- return new Iterator() {
- private int current = 0;
-
- public boolean hasNext() {
- return current < size();
- }
-
- public Object next() {
- if(!hasNext()) {
- throw new java.util.NoSuchElementException();
- }
- return elementData[current++];
- }
- };
- }
-
-}
diff --git a/group01/378213871/src/com/coding/basic/week01/BinaryTreeNode.java b/group01/378213871/src/com/coding/basic/week01/BinaryTreeNode.java
deleted file mode 100644
index 36e20a95c5..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.coding.basic.week01;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
diff --git a/group01/378213871/src/com/coding/basic/week01/Iterator.java b/group01/378213871/src/com/coding/basic/week01/Iterator.java
deleted file mode 100644
index 365e98e8b4..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.coding.basic.week01;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/378213871/src/com/coding/basic/week01/LinkedList.java b/group01/378213871/src/com/coding/basic/week01/LinkedList.java
deleted file mode 100644
index dd6f3fb2e6..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/LinkedList.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.coding.basic.week01;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-
- private Node head;
-
- private int size;
-
- public void add(Object o){
- if (head == null) {
- head = new Node(o);
- size++;
- } else{
- addLast(o);
- }
- }
- public void add(int index , Object o){
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- }
- if (index == 0) {
- addFirst(o);
- } else {
- //定义标记节点sentinelNode,标记节点的下一个节点即为要新加的元素
- Node sentinelNode = head;
- for (int i = 0; i < index - 1; i++) {
- sentinelNode = sentinelNode.next;
- }
- Node node = new Node(o);
- node.next = sentinelNode.next;
- sentinelNode.next = node;
- size++;
- }
- }
- public Object get(int index){
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- } else {
- Node indexNode = head;
- for (int i = 0; i < index; i++) {
- indexNode = indexNode.next;
- }
- return indexNode.data;
- }
- }
- public Object remove(int index){
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- } else {
- /**
- * sentinelNode是所删除节点的上一个节点;
- * indexNode是需要被删除的节点
- */
- Node sentinelNode = head;
- Node indexNode = head;
- for (int i = 0; i < index - 1; i++) {
- sentinelNode = sentinelNode.next;
- }
- for (int i = 0; i < index; i++) {
- indexNode = indexNode.next;
- }
- Node nextIndexNode = indexNode.next;
- sentinelNode.next = nextIndexNode;
- indexNode.next = null;
- size--;
- return indexNode.data;
- }
- }
-
- public int size(){
- return size;
- }
-
- public void addFirst(Object o){
- Node node = new Node(o);
- node.next = head;
- head = node;
- size++;
- }
- public void addLast(Object o){
- //定义尾节点并通过while循环找到当前链表的尾节点
- Node tailNode = head;
- while (tailNode.next != null) {
- tailNode = tailNode.next;
- }
- Node node = new Node(o);
- tailNode.next = node;
- size++;
- }
- public Object removeFirst(){
- if (head == null) {
- throw new NoSuchElementException();
- }
- Node newNode = head;
- head = head.next;
- size--;
- return newNode.data;
- }
- public Object removeLast(){
- if (head == null) {
- throw new NoSuchElementException();
- }
- Node newNode = head;
- while (newNode.next.next != null) {
- newNode = newNode.next;
- }
- Node lastNode = newNode.next;
- newNode.next = null;
- size--;
- return lastNode.data;
- }
-
- public Iterator iterator(){
- return null;
- }
-
-
- private static class Node{
- Object data;
- Node next; // 下一个节点
-
- private Node(Object data) {
- this.data = data;
- next = null;
- }
- }
-}
diff --git a/group01/378213871/src/com/coding/basic/week01/List.java b/group01/378213871/src/com/coding/basic/week01/List.java
deleted file mode 100644
index 966ca016e8..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.coding.basic.week01;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-}
diff --git a/group01/378213871/src/com/coding/basic/week01/Queue.java b/group01/378213871/src/com/coding/basic/week01/Queue.java
deleted file mode 100644
index 1b25880f67..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/Queue.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.coding.basic.week01;
-
-public class Queue {
- private LinkedList list = new LinkedList();
- //入队列
- public void enQueue(Object o){
- list.add(o);
- }
- //出队列
- public Object deQueue(){
- if(list.size() == 0) {
- return null;
- }
- return list.removeFirst();
- }
-
- public boolean isEmpty(){
- return list.size() == 0;
- }
-
- public int size(){
- return list.size();
- }
-}
diff --git a/group01/378213871/src/com/coding/basic/week01/Stack.java b/group01/378213871/src/com/coding/basic/week01/Stack.java
deleted file mode 100644
index 64cfa30da6..0000000000
--- a/group01/378213871/src/com/coding/basic/week01/Stack.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.coding.basic.week01;
-
-import java.util.EmptyStackException;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- //入栈
- public void push(Object o){
- elementData.add(o);
-
- }
-
- //出栈
- public Object pop(){
- if(elementData.size() == 0) {
- throw new EmptyStackException();
- }
- return elementData.remove(elementData.size() - 1);
- }
-
- //读取栈顶元素
- public Object peek(){
- if(elementData.size() == 0) {
- throw new EmptyStackException();
- }
- return elementData.get(elementData.size() - 1);
- }
- public boolean isEmpty(){
- return size() == 0;
- }
- public int size(){
- return elementData.size();
- }
-}
diff --git a/group01/496740686/src/Impl/MyArraryList.java b/group01/496740686/src/Impl/MyArraryList.java
deleted file mode 100644
index 20fb5dcfdf..0000000000
--- a/group01/496740686/src/Impl/MyArraryList.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package Impl;
-
-import Interface.ArrayList;
-import Interface.Iterator;
-import ex.MyArrest;
-
-/**
- * Created by Administrator on 2017/2/25.
- */
-public class MyArraryList extends ArrayList {
- private Object[] objArr;
- private int size;
- private int postion;
-
- public MyArraryList() {
- this.objArr = new Object[10];
- this.size = 10;
- this.postion = 0;
- }
-
-
- public MyArraryList(int size) {
- this.objArr = new Object[size];
- this.size = size;
- this.postion = 0;
- }
-
- public MyArraryList(Object[] objArr) {
- this.objArr = objArr;
- this.size = objArr.length;
- this.postion = objArr.length - 1;
- }
-
- @Override
- public void add(Object o) {
- int limit = this.size + (this.size / 2);
- Object[] newObjArr = new Object[limit];
- //public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)从指定源数组中复制一个数组,
- // 复制从指定的位置开始,到目标数组的指定位置结束。从src引用的源数组到dest引用的目标数组,
- // 数组组件的一个子序列被复制下来。被复制的组件的编号等于length参数。
- // 源数组中位置在srcPos到srcPos+length-1之间的组件被分别复制到目标数组中的destPos到destPos+length-1位置。
- System.arraycopy(this.objArr, 0, newObjArr, 0, objArr.length);
- this.postion = this.size - 1;
- newObjArr[this.postion] = o;
- this.size = limit;
- objArr = null;
- this.objArr = newObjArr;
- }
-
- @Override
- public void add(int index, Object o) {
- arrIndexVildate(index);
- objArr[index - 1] = o;
- size++;
- }
-
- @Override
- public Object get(int index) {
- arrIndexVildate(index);
- return objArr[index - 1];
- }
-
- @Override
- public Object remove(int index) {
- arrIndexVildate(index);
- Object remoteObj = objArr[index - 1];
- objArr[index - 1] = null;
- size--;
- //TODO need GC ccontrol
- return remoteObj;
- }
-
- @Override
- public int size() {
- return this.size;
- }
-
- @Override
- public Iterator iterator() {
- return new ArrayListIterator(this);
- }
-
- private class ArrayListIterator implements Iterator {
- private MyArraryList arraryList;
- private int index;
-
- public ArrayListIterator(MyArraryList arraryList) {
- this.arraryList = arraryList;
- this.index = arraryList.size - 1;
- }
-
- @Override
- public boolean hasNext() {
- if (index > arraryList.size) {
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public Object next() {
- Object obj = arraryList.get(index);
- index++;
- return obj;
- }
- }
-
- private void arrIndexVildate(int index) {
- if (index > size - 1 || index < 0) {
- new Exception(String.format("cant than that array index %s,but got %", size - 1, index));
- }
- }
-
- //test method
- public static void main(String[] args) {
- MyArraryList myArrary = new MyArraryList();
- MyArrest.arrestEq(10, myArrary.size());
- myArrary.add(1, 10);
- MyArrest.arrestEq(10, myArrary.get(1));
- myArrary.add(100);
- System.out.println(myArrary.get(11));
- myArrary.remove(1);
- MyArrest.arrestIsNull(myArrary.get(1));
- if (myArrary.iterator().hasNext()) {
- myArrary.iterator().next();
- }
- System.out.println("test myArrary2");
- MyArraryList myArrary2 = new MyArraryList(20);
- MyArrest.arrestEq(20, myArrary2.size());
- myArrary2.add(1, 10);
- MyArrest.arrestEq(10, myArrary2.get(1));
- myArrary2.add(100);
- MyArrest.arrestIsNull(myArrary2.get(20));
- myArrary2.remove(1);
- MyArrest.arrestIsNull(myArrary2.get(1));
- if (myArrary.iterator().hasNext()) {
- myArrary2.iterator().next();
- }
- }
-}
diff --git a/group01/496740686/src/Impl/MyLinkedList.java b/group01/496740686/src/Impl/MyLinkedList.java
deleted file mode 100644
index 017bac5baf..0000000000
--- a/group01/496740686/src/Impl/MyLinkedList.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package Impl;
-
-import Interface.Iterator;
-import Interface.LinkedList;
-import ex.MyArrest;
-
-/**
- * Created by Administrator on 2017/2/26.
- */
-public class MyLinkedList extends LinkedList {
- private MyLinkedList.Node head;
- private int size = 1;
-
- public MyLinkedList() {
-
- }
-
- private static class Node {
- Object data;
- MyLinkedList.Node next;
-
- public Node(Object data, Node next) {
- this.data = data;
- this.next = next;
- }
- }
-
- public void add(Object o) {
- if (this.size == 1) {
- head.data = o;
- return;
- }
- MyLinkedList.Node newHead = new MyLinkedList.Node(o, this.head);
- this.size += 1;
- this.head = newHead;
- }
-
-
- public void add(int index, Object o) {
- IndexVildate(index);
- int pos = 0;
- if (index == 1) {
- this.head = new Node(o, null);
- return;
- }
- for (MyLinkedList.Node node = this.head; node != null; node = node.next) {
- pos += 1;
- if (pos == index - 1) {
- node.data = o;
- this.size += 1;
- }
- }
- }
-
-
- public Object get(int index) {
- int pos = 0;
- for (MyLinkedList.Node node = this.head; node != null; node = node.next) {
- if (pos == index - 1) {
- return node.data;
- }
- pos += 1;
- }
- return null;
- }
-
-
- public Object remove(int index) {
- IndexVildate(index);
- int pos = 0;
- MyLinkedList.Node preNode;
- for (MyLinkedList.Node node = this.head; node != null; node = node.next) {
- pos += 1;
- if (pos == index - 2) {
- //record previous node
- preNode = node;
- if (pos == index - 1) {
- MyLinkedList.Node willDelNode = node;
- preNode.next = node.next;
- node = null;
- this.size -= 1;
- return willDelNode;
- }
- }
- }
- return null;
- }
-
-
- public int size() {
- return this.size;
- }
-
-
- public void addFirst(Object o) {
- MyLinkedList.Node newHead = this.head;
- newHead.data = o;
- newHead.next = this.head;
- this.size += 1;
- this.head = newHead;
- }
-
-
- public void addLast(Object o) {
- for (MyLinkedList.Node node = this.head; node != null; node = node.next) {
- if (node.next == null) {
- MyLinkedList.Node lastNode = new MyLinkedList.Node(o, null);
- node.next = lastNode;
- this.size += 1;
- }
- }
- }
-
-
- public Object removeFirst() {
- MyLinkedList.Node oldHead = this.head;
- this.head = oldHead.next;
- this.size -= 1;
- return oldHead;
- }
-
-
- public Object removeLast() {
- for (MyLinkedList.Node node = this.head; node != null; node = node.next) {
- if (node.next == null) {
- MyLinkedList.Node willDelNode = node.next;
- node.next = null;
- this.size -= 1;
- return willDelNode;
- }
- }
- return null;
- }
-
- public Iterator iterator() {
- return new LinkedListIterator(this);
- }
-
- private class LinkedListIterator implements Iterator {
- private MyLinkedList linkedList;
- private int index;
-
- public LinkedListIterator(MyLinkedList linkedList) {
- this.linkedList = linkedList;
- this.index = linkedList.size;
- }
-
- @Override
- public boolean hasNext() {
- if (index > linkedList.size) {
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public Object next() {
- Object obj = linkedList.get(index);
- index++;
- return obj;
- }
- }
-
- private void IndexVildate(int index) {
- if (index > this.size || index < 0) {
- System.out.println("happend error");
- }
- }
-
- public static void main(String[] args) {
- MyLinkedList linkedList = new MyLinkedList();
- linkedList.add(1, 23);
- MyArrest.arrestEqByBasicType(1, linkedList.size());
-
- }
-}
diff --git a/group01/496740686/src/Impl/MyQueue.java b/group01/496740686/src/Impl/MyQueue.java
deleted file mode 100644
index 1a029738d2..0000000000
--- a/group01/496740686/src/Impl/MyQueue.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package Impl;
-
-import Interface.Queue;
-
-/**
- * Created by Administrator on 2017/2/26.
- */
-public class MyQueue extends Queue {
-
- private Node first; // beginning of queue
- private Node last; // end of queue
- private int size; // number of elements on queue
-
- private static class Node {
- private Object value;
- private Node next;
-
- public Node(Object value, Node next) {
- this.value = value;
- this.next = next;
- }
- }
-
- public MyQueue() {
- first = null;
- last = null;
- int n = 0;
- }
-
- @Override
- public void enQueue(Object o) {
- Node oldlast = this.last;
- this.last = new Node(o, null);
- size += 1;
- //第一个进队列
- if (isEmpty()) {
- first = last;
- } else {
- oldlast.next = this.last;
- }
-
- }
-
- @Override
- public Object deQueue() {
- if (isEmpty()) {
- return null;
- } else {
- Node oldFirst = this.first;
- Node newFirst = this.first.next;
- this.first = null;
- this.first = newFirst;
- this.size -= 1;
- return oldFirst;
-
- }
- }
-
- @Override
- public boolean isEmpty() {
- return first == null;
- }
-
- @Override
- public int size() {
- return size;
- }
-}
diff --git a/group01/496740686/src/Impl/MyStack.java b/group01/496740686/src/Impl/MyStack.java
deleted file mode 100644
index 3a7c119e99..0000000000
--- a/group01/496740686/src/Impl/MyStack.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package Impl;
-
-import Interface.ArrayList;
-import Interface.Stack;
-
-
-/**
- * Created by Administrator on 2017/2/26.
- */
-public class MyStack extends Stack {
-
- private MyStack.Node first; // beginning of queue
- private MyStack.Node last; // end of queue
- private int size; // number of elements on queue
-
- private static class Node {
- private Object value;
- private MyStack.Node next;
-
- public Node(Object value, MyStack.Node next) {
- this.value = value;
- this.next = next;
- }
- }
-
- public MyStack() {
- first = null;
- last = null;
- int n = 0;
- }
-
- @Override
- public void push(Object o) {
- if (isEmpty()) {
- MyStack.Node oldFirst = this.first;
- this.first = new MyStack.Node(o, null);
- size += 1;
- //第一个进栈
- if (isEmpty()) {
- first = last;
- } else {
- oldFirst.next = this.last;
- }
- }
- }
-
- @Override
- public Object pop() {
- if (isEmpty()) {
- return null;
- } else {
- MyStack.Node oldFirst = this.first;
- this.first = oldFirst.next;
- this.size -= 1;
- return oldFirst;
-
- }
-
- }
-
- @Override
- public Object peek() {
- return this.first;
- }
-
- @Override
- public boolean isEmpty() {
- return first == null;
- }
-}
diff --git a/group01/496740686/src/Interface/ArrayList.java b/group01/496740686/src/Interface/ArrayList.java
deleted file mode 100644
index 567c1996b1..0000000000
--- a/group01/496740686/src/Interface/ArrayList.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package Interface;
-
-
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
-
- }
- public void add(int index, Object o){
-
- }
-
- public Object get(int index){
- return null;
- }
-
- public Object remove(int index){
- return null;
- }
-
- public int size(){
- return -1;
- }
-
- public Iterator iterator(){
- return null;
- }
-
-}
diff --git a/group01/496740686/src/Interface/BinaryTreeNode.java b/group01/496740686/src/Interface/BinaryTreeNode.java
deleted file mode 100644
index c5480a614f..0000000000
--- a/group01/496740686/src/Interface/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package Interface;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
diff --git a/group01/496740686/src/Interface/Iterator.java b/group01/496740686/src/Interface/Iterator.java
deleted file mode 100644
index 77e3c0b216..0000000000
--- a/group01/496740686/src/Interface/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package Interface;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group01/496740686/src/Interface/LinkedList.java b/group01/496740686/src/Interface/LinkedList.java
deleted file mode 100644
index b7166a1731..0000000000
--- a/group01/496740686/src/Interface/LinkedList.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package Interface;
-
-public class LinkedList implements List {
-
- private Node head;
-
- public void add(Object o){
-
- }
- public void add(int index , Object o){
-
- }
- public Object get(int index){
- return null;
- }
- public Object remove(int index){
- return null;
- }
-
- public int size(){
- return -1;
- }
-
- public void addFirst(Object o){
-
- }
- public void addLast(Object o){
-
- }
- public Object removeFirst(){
- return null;
- }
- public Object removeLast(){
- return null;
- }
- public Iterator iterator(){
- return null;
- }
-
-
- private static class Node{
- Object data;
- Node next;
-
- }
-
-}
diff --git a/group01/496740686/src/Interface/List.java b/group01/496740686/src/Interface/List.java
deleted file mode 100644
index 98d6a4da0a..0000000000
--- a/group01/496740686/src/Interface/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package Interface;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-}
diff --git a/group01/496740686/src/Interface/Queue.java b/group01/496740686/src/Interface/Queue.java
deleted file mode 100644
index 8e3a5d5f43..0000000000
--- a/group01/496740686/src/Interface/Queue.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package Interface;
-
-public class Queue {
-
- public void enQueue(Object o){
- }
-
- public Object deQueue(){
- return null;
- }
-
- public boolean isEmpty(){
- return false;
- }
-
- public int size(){
- return -1;
- }
-}
diff --git a/group01/496740686/src/Interface/Stack.java b/group01/496740686/src/Interface/Stack.java
deleted file mode 100644
index 7e536e250a..0000000000
--- a/group01/496740686/src/Interface/Stack.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package Interface;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o){
- }
-
- public Object pop(){
- return null;
- }
-
- public Object peek(){
- return null;
- }
- public boolean isEmpty(){
- return false;
- }
- public int size(){
- return -1;
- }
-}
diff --git a/group01/496740686/src/ex/MyArrest.java b/group01/496740686/src/ex/MyArrest.java
deleted file mode 100644
index 9987b83535..0000000000
--- a/group01/496740686/src/ex/MyArrest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package ex;
-
-/**
- * Created by Administrator on 2017/2/26.
- */
-public class MyArrest {
-
-
- public static void arrestEq(T expect, T value) {
- if (expect == null || value == null) {
- if (expect == value) {
- System.out.println("it's ok \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
- if (expect.equals(value)) {
- System.out.println("it's ok \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
-
- public static void arrestEq(T expect, T value, String errorInfo) {
- if (expect == null || value == null) {
- if (expect == value) {
- System.out.println("it's ok \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
- if (expect.equals(value)) {
- System.out.println("it's ok \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
-
- public static void arrestEqByBasicType(T expect, T value) {
- if (expect == null || value == null) {
- if (expect == value) {
- System.out.println("it's ok \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
- if (expect == value) {
- System.out.println("it's ok \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
-
- public static void arrestIsNull(Object obj) {
- if (obj == null) {
- System.out.println("it's null , you're right \n" );
- return;
- } else {
- System.out.println("happend error \n" );
- return;
- }
- }
-}
diff --git a/group01/751425278/.classpath b/group01/751425278/.classpath
deleted file mode 100644
index fb5011632c..0000000000
--- a/group01/751425278/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/group01/751425278/.gitignore b/group01/751425278/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group01/751425278/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group01/751425278/.project b/group01/751425278/.project
deleted file mode 100644
index 85d6b2c816..0000000000
--- a/group01/751425278/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- basicDataStructure
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/751425278/src/com/sanmubird/basicDataStructure/ArrayList.java b/group01/751425278/src/com/sanmubird/basicDataStructure/ArrayList.java
deleted file mode 100644
index 3e6c874d90..0000000000
--- a/group01/751425278/src/com/sanmubird/basicDataStructure/ArrayList.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.sanmubird.basicDataStructure;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- /** ArrayList 是一个类,一个类就会有对象,属性,构造方法,方法
- * ArrayList 是基于数组来实现List接口; 那么它的元素就会有 存储在数组中的元素, 和ArrayList的长度
- * 这个地方需要区分size= ArrayList.size() 和 length = Array.length ;
- * size 是 已经占用的长度;
- * length 是数组的长度; length 》= size 当,size > length 时,数组要动态扩容;
- * */
-
-// 数组默认的长度
- private static final int DEFAULT_SIZE = 10;
-
-// ArrayList的大小
- private int size ;
-
-// 数组中存储的元素
- private Object[] elementData = null;
-
- private int count ;
-
-// ArrayList 的构造方法 通过构造方法 可以得到这个类的对象
-// 有参构造方法
- public ArrayList(int i){
- if(i <= 0 ){
- throw new RuntimeException("数组的长度不能小于等于0");
- }else{
- this.elementData = new Object[i];
- this.size = 0 ; // 集合ArrayList的大小;
- }
- }
- // 无参构造方法
- public ArrayList(){
- this(DEFAULT_SIZE); // this 会调用本类中 相同参数(相同的参数个数和参数类型)的构造方法;
- }
-
- /** ArrayList 其他方法分析
- * 目标方法:
- * size(); Array的length就是ArrayList的大小
- * get(int index); Array的【index-1】就是 ArrayList的第index位元素
- * add(Object o) ; 这个方法是在数组的末尾顺序添加一个元素; 找到数组的长度size,将array【size-1】= Object
- * add(int index , Object o); 这个方法是在数组的指定位置添加一个元素;找到index位,将index位起往后挪一位,并将array【index】=Object
- * remove(int index); 这个方法是 删除指定位上的元素,直接将这个位至最后的元素往前挪移一位。
- *
- * 工具方法:
- * argumentCheck(int index); 判断输入的参数是否合法;比如传入的参数不能比数组长度大,或者不能为负数等
- * ensureCapacity(); 判断当前数组的长度是否足够大,能再容纳下一个元素。
- *
- * */
-
-
-// 对传入的参数进行验证是否合法 如果输入的参数不合法 就抛出异常
- public void argumentCheck(int index){
- if(index >= size || index < 0 ){ // 此处我觉得需要 ‘=’ 因为 index 我觉得是下标
- throw new IndexOutOfBoundsException("插入的下标是:"+index +",但ArrayLsit的长度是:"+size);
- }
- }
-
- // 判断是否数组是否溢出的方法 如果数组现在的长度小于所需的最小长度,就需要对数组进行扩容
- public void ensureCapacity(int minCapacity){
- int length = elementData.length; // 得出当前数组的长度
- if(minCapacity > length){
- int newCapacity = length * 3 / 2 + 1 ; //你是否对此有疑问?得出的结果会不会是小数? 答案是不会的,java中算术运算符“/”;两个int类型相除,结果一定是int类型
- if(minCapacity > newCapacity ){
- newCapacity = minCapacity ;
- }
- count++;
- System.out.println("扩容"+count+"次");
- elementData = Arrays.copyOf(elementData, newCapacity);//此处为什么用Arrays.copyOf()而不用System.arraycopy()?
- // Arrays.copyOf(): 不仅仅copy数组中的元素,还会创建一个新的数组来存放copy的对象
- // System.arraycopy():仅仅是copy数组中的元素,不会新建一个数组对象,也不会改变原有的数组长度。
- // 在原有数组长度不够的情况下,只能选择新建一个数组,并将原有的数组复制到新数组的办法来解决。
- }
- }
-
- // 得到ArrayList 大小的方法 ; 此处的size 不是Array的length,而是ArrayList中元素的个数
- public int size(){
- return size;
- }
-
-// 传入下标得到元素
- public Object get(int index){
- argumentCheck(index); //需要判断传入的参数是否合法;
- return elementData[index];
- }
-
-// 按顺序在数字尾部添加元素
- public void add(Object o){
- ensureCapacity(size+1); // 判断是否会溢出
- elementData[size++] = o ; //此处使用 size++ 的好处:elementData[size+1];size++;
- }
-
- public void add(int index, Object o){ //这个地方需要搞清楚index的含义:index在此处是下标的意思
- argumentCheck(index); //判断输入的下标是否合法 --->
- // 刚开始的时候 ; 我觉得这个地方不需要加这个判断,因为ArrayList是动态增长的;
- // 我还需要想明白这个问题;
- ensureCapacity(size+1); // 判断是否会溢出
- int moveLength = size - (index + 1) + 1; // 此处index是下标;下标是从0开始计算的;所以第n位的下标就是(n-1);所以,n = index + 1
- // 此处的 +1 刚开始没想明白,后来组长给举了个例子,1-3 有三个数,但不是通过3-1=2 算出来的
- System.arraycopy(elementData, index, elementData, index+1, moveLength );
- elementData[index] = o ;
- size++;
- }
-
- public Object remove(int index){
- argumentCheck(index); //判断输入的下标是否合法
- Object o = elementData[index];
- System.arraycopy(elementData, index, elementData, index-1, size-index);
- elementData[size] = null ;
- size--;
- return o;
- }
-
- public Iterator iterator(){
- return new Iterator(){
- private int index = 0 ;
-
- @Override
- public Object next(){
- return elementData[index++];
- }
- @Override
- public boolean hasNext() {
- return index < size ;
- }
- };
- }
-
- public static void main(String [] args){
- ArrayList al = new ArrayList();
- al.add(1);
- al.add(2);
- al.add(4);
- al.add(5);
- al.add(6);
- al.add(7);
- al.add(2,3);
- al.add(8);
- al.add(9);
- al.add(10);
- al.add(11);
- al.add(13);
- al.add(9,12);
- al.add(14);
- al.add(15);
- al.remove(9);
- for(int i = 0 ; i < al.size() ; i++ ){
- System.out.println(al.get(i));
- }
- System.out.println("al的size是"+al.size());
- System.out.println(al.get(15));
- }
-}
\ No newline at end of file
diff --git a/group01/751425278/src/com/sanmubird/basicDataStructure/BinaryTreeNode.java b/group01/751425278/src/com/sanmubird/basicDataStructure/BinaryTreeNode.java
deleted file mode 100644
index 4096c79e36..0000000000
--- a/group01/751425278/src/com/sanmubird/basicDataStructure/BinaryTreeNode.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.sanmubird.basicDataStructure;
-
-public class BinaryTreeNode {
- /** 二叉树同时具有数组和链表各自的特点:它可以像数组一样迅速查找;也可以像链表一样快速添加;
- * 但 删除操作复杂;
- * 二叉树是每个节点最多有两个子树的有序树;
- * 一个节点的左子点的关键值必须小于此节点,右节点的关键值必须大于或者等于此节点,
- * */
-
-
- private Integer data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(Integer i){
- this.data = i ;
- }
-
-
- public Object getData() {
- return data;
- }
- public void setData(Integer i) {
- this.data = i;
- }
- 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;
- }
-
- public BinaryTreeNode insert(Integer i){
- BinaryTreeNode node = new BinaryTreeNode(i);
- if(i > this.data){
- if(this.getRight() == null ){
- this.setRight(node);
- return node;
- }else{
- return this.getRight().insert(i);
- }
- }else{
- if(this.getLeft() == null ){
- this.setLeft(node);
- return node ;
- }else{
- return this.getLeft().insert(i);
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/group01/751425278/src/com/sanmubird/basicDataStructure/Iterator.java b/group01/751425278/src/com/sanmubird/basicDataStructure/Iterator.java
deleted file mode 100644
index df4a1e3a6d..0000000000
--- a/group01/751425278/src/com/sanmubird/basicDataStructure/Iterator.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.sanmubird.basicDataStructure;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-}
\ No newline at end of file
diff --git a/group01/751425278/src/com/sanmubird/basicDataStructure/LinkedList.java b/group01/751425278/src/com/sanmubird/basicDataStructure/LinkedList.java
deleted file mode 100644
index 31703dd5f1..0000000000
--- a/group01/751425278/src/com/sanmubird/basicDataStructure/LinkedList.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package com.sanmubird.basicDataStructure;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
- /** 链表:是由节点(Node)组成的,
- * 而向外暴露的只有一个头节点;我们对链表的所有操作,都是直接或简洁地通过头节点来实现的。
- * 节点(Node)是由 一个 存储的对象和一个对下个节点的引用组成的。
- * Node中最重要的就是引用了,如果说对ArrayList的增删是ArrayCopy的话,那对LinkedList的增删就是改变引用的指向。
- * 因为节点的添加顺序是自右向左的,且最左边的节点是头节点;
- * 所以,新添加的节点会在左边,而是新添加的节点会成为新的t头节点。
- * 头节点可以通过对下一个节点的引用,来找到所有的节点;
- * 所以:链表里面的属性就有两个,一个是头节点,一个是节点的数量。
- ***/
- private Node head; //定义一个头节点
- private int size ; //节点的数量
-
- public LinkedList(){
- this.head = null ;
- this.size = 0 ;
- }
-
-// 检查输入的参数是否合法
- public void argumentCheckForAdd(int index){
- if(index > size || index < 0 ){ //这个地反需要验证 index = 0 的情况
- throw new IndexOutOfBoundsException("输入的参数超出了边界!");
- }
- }
-
-// 检查输入的参数是否合法
- public void argumentCheckForOther(int index){
- if(index >= size || index < 0 ){
- throw new IndexOutOfBoundsException("输入的参数超出了边界!");
- }
- }
-
-
- public Node getHead(){
- return head ;
- }
-
- public Object get(int index){
- argumentCheckForOther(index);
- Node node = head ;
- for(int i = 0 ; i < index ; i++){
- node = head.next ;
- }
- return node.data;
- }
- public int size(){
- return size; // return this.size 跟 return size ;有区别没有?
- }
-
-//
- public void add(Object o){
- Node newNode = new Node(o); //实例化一个要添加的节点
- if(head == null ){
- head = newNode ;
- }else{
- Node temp = head ;
- while (temp.next != null ){ //这个地方为什么是 temp.next != null ?
- // 这个地方的作用就是:取出下一个节点;那么当然是在存在下个节点的情况下,才能取出下个节点
- temp = temp.next ;
- // 这样就找到了最后一个节点: temp
- }
- temp.next = newNode ;
- }
- size++;
- }
-
-// 这个通过画图,然后看图说话就很容易弄出来。
- public void add(int index , Object o){
- argumentCheckForAdd(index);
- if(size == index )
- add(o);
- else{
- Node preNode = head ;
- for (int i = 0 ; i < index ; i++){
- preNode = preNode.next;
- }
- Node nextNode = preNode.next ;
- Node node = new Node(o);
- preNode.next = node;
- node.next = nextNode;
- size++;
- }
- }
-
- public Object remove(int index){
- argumentCheckForOther(index);
- Node temp = head ;
- for(int i = 0 ; i < index ; i++){
- temp = temp.next ;
- }
- Node removedNode = temp.next ;
- Node nextNode = removedNode.next ;
- temp.next = nextNode ;
- size--;
- return removedNode.data;
- }
-
-
- public void addFirst(Object o){
- Node node = new Node(o);
- node.next = head ;
- head = node ;
- size++;
- }
-
- public void addLast(Object o){
- Node lastNode = head ;
- while(lastNode.next != null ){
- lastNode = lastNode.next ;
- }
- Node node = new Node(o);
- lastNode.next = node ;
- size++;
- }
-
- public void noSuchElement(){
- if(head.next == null){
- throw new NoSuchElementException("没有这个元素");
- }
- }
-
-
- public Object removeFirst(){
- noSuchElement();
- Node node = head.next ;
- head.next = node.next ;
- size--;
- return node.data;
- }
-
- public Object removeLast(){
- noSuchElement();
- Node temp = head ;
- for(int i = 0 ; i 0){
- this.queArray = new Object[initialSize];
- this.maxSize = initialSize;
- this.front = this.rear = 0 ;
- }else{
- throw new RuntimeException("初始化的大小不能小于0;"+ initialSize);
- }
-}
-
- public void enQueue(Object o){
- if(rear == maxSize){
- throw new RuntimeException("队列已满,无法插入新的元素!");
- }else{
- queArray[rear++] = o ;
- }
- }
-
- public Object deQueue(){
- if(isEmpty()){
- throw new RuntimeException("空队列异常!");
- }else{
- Object obj = (Object) queArray[front];
- queArray[front++] = null;
- return obj;
- }
- }
-
- //判空
- public boolean isEmpty(){
- return rear == front?true:false;
- }
-
- public int size(){
- return rear-front;
- }
- */
-
-
- /** 采用链表实现对队列;队列的特点是:先进先出,而且不能插队;所以只能从尾进,从头出。
- *
- * */
- private LinkedList ll ;
-
- public Queue(){
- this.ll = new LinkedList();
- }
-
- public void enQueue(Object o){
- ll.addLast(o);
- }
-
- public Object deQueue(){
- return ll.removeLast();
- }
-
- public boolean isEmpty(){
- return ll.getHead().next == null ? true: false;
- }
-
- public int size(){
- return ll.size();
- }
-}
\ No newline at end of file
diff --git a/group01/751425278/src/com/sanmubird/basicDataStructure/Stack.java b/group01/751425278/src/com/sanmubird/basicDataStructure/Stack.java
deleted file mode 100644
index 7c6b03b3df..0000000000
--- a/group01/751425278/src/com/sanmubird/basicDataStructure/Stack.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.sanmubird.basicDataStructure;
-
-public class Stack {
-
- private Object[] arrayStack ;//
- private int maxSize ; //栈容量
- private int top ; //栈指针;
-
- public Stack(int initialSize){
- if(initialSize >= 0 ){
- this.arrayStack = new Object[initialSize];
- this.maxSize = initialSize ;
- this.top = -1 ;
- }else{
- throw new RuntimeException("初始化的大小不能小于0"+initialSize);
- }
- }
-
- // 进栈,进栈的第一个元素的top = 0 ;
- public void push(Object o){
- if(top == maxSize -1 ){
- throw new RuntimeException("栈已满,无法将元素插入栈");
- }else{
- arrayStack[++top] = o ;
- }
- }
-
- public Object pop(){
- if(top == -1){
- throw new RuntimeException("栈为空!");
- }else{
- return arrayStack[top--];
- }
- }
-
-// 查看栈顶元素,但是不移除
- public Object peek(){
- if(top == -1){
- throw new RuntimeException("栈为空!");
- }else{
- return arrayStack[top];
- }
- }
- public boolean isEmpty(){
- return top == -1 ? true : false;
- }
- public int size(){
- return arrayStack.length;
- }
-}
\ No newline at end of file
diff --git a/group01/765324639/src/zavier/week01/basic/ArrayList.java b/group01/765324639/src/zavier/week01/basic/ArrayList.java
deleted file mode 100644
index 38e5739fb8..0000000000
--- a/group01/765324639/src/zavier/week01/basic/ArrayList.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package zavier.week01.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- @Override
- public void add(Object o) {
- ensureCapacity(size + 1);
- elementData[size++] = o;
- }
-
- private void ensureCapacity(int size) {
- if (size > elementData.length) {
- grow();
- }
- }
-
- private void grow() {
- elementData = Arrays.copyOf(elementData, size * 2);
- }
-
- @Override
- public void add(int index, Object o) {
- rangeCheckForAdd(index);
- ensureCapacity(size + 1);
- System.arraycopy(elementData, index, elementData, index + 1, size - index);
- elementData[index] = o;
- size++;
- }
-
- private void rangeCheckForAdd(int index) {
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- @Override
- public Object get(int index) {
- rangeCheck(index);
- return elementData[index];
- }
-
- private void rangeCheck(int index) {
- if (index >= size || index < 0) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- @Override
- public Object remove(int index) {
- rangeCheck(index);
- Object dest = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
- size--;
- return dest;
- }
-
- @Override
- public int size() {
- return size;
- }
-
- public Iterator iterator() {
- return new Iterator() {
-
- private int index = 0;
-
- @Override
- public Object next() {
- return elementData[index++];
- }
-
- @Override
- public boolean hasNext() {
- return index < size;
- }
- };
- }
-
-}
diff --git a/group01/765324639/src/zavier/week01/basic/BinaryTreeNode.java b/group01/765324639/src/zavier/week01/basic/BinaryTreeNode.java
deleted file mode 100644
index 6ef26e8f9a..0000000000
--- a/group01/765324639/src/zavier/week01/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package zavier.week01.basic;
-
-public class BinaryTreeNode {
-
- private Integer data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(Integer data) {
- this.data = data;
- }
-
- public Integer getData() {
- return data;
- }
-
- public void setData(Integer 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;
- }
-
- public BinaryTreeNode insert(Integer o) {
-
- if (o > this.data) {
-
- if (this.getRight() == null) {
- BinaryTreeNode node = new BinaryTreeNode(o);
- this.setRight(node);
- return node;
- } else {
- return this.getRight().insert(o);
- }
-
- } else {
-
- if (this.getLeft() == null) {
- BinaryTreeNode node = new BinaryTreeNode(o);
- this.setLeft(node);
- return node;
- } else {
- return this.getLeft().insert(o);
- }
-
- }
-
- }
-
-}
diff --git a/group01/765324639/src/zavier/week01/basic/Iterator.java b/group01/765324639/src/zavier/week01/basic/Iterator.java
deleted file mode 100644
index 664983e0fd..0000000000
--- a/group01/765324639/src/zavier/week01/basic/Iterator.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package zavier.week01.basic;
-
-public interface Iterator {
- public boolean hasNext();
-
- public Object next();
-
-}
diff --git a/group01/765324639/src/zavier/week01/basic/LinkedList.java b/group01/765324639/src/zavier/week01/basic/LinkedList.java
deleted file mode 100644
index c876b48f1b..0000000000
--- a/group01/765324639/src/zavier/week01/basic/LinkedList.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package zavier.week01.basic;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-
- private Node head;
-
- private int size = 0;
-
- @Override
- public void add(Object o) {
- if (head == null) {
- head = new Node(o);
- } else {
- Node tail = head;
- while (tail.next != null) {
- tail = tail.next;
- }
- Node node = new Node(o);
-
- tail.next = node;
- }
- size++;
- }
-
- @Override
- public void add(int index, Object o) {
- rangeCheckForAdd(index);
- if (index == 0) {
- Node node = new Node(o);
- node.next = head;
- head = node;
- } else {
- Node preDest = head;
- for (int i = 0; i < index - 1; i++) {
- preDest = preDest.next;
- }
- Node node = new Node(o);
- node.next = preDest.next;
- preDest.next = node;
- }
-
- size++;
- }
-
- private void rangeCheckForAdd(int index) {
- if (index > size || index < 0) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- @Override
- public Object get(int index) {
- rangeCheck(index);
-
- Node dest = head;
- for (int i = 0; i < index; i++) {
- dest = dest.next;
- }
- return dest.data;
- }
-
- private void rangeCheck(int index) {
- if (index >= size || index < 0) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- @Override
- public Object remove(int index) {
- rangeCheck(index);
-
- Node preDest = head;
- for (int i = 0; i < index - 1; i++) {
- preDest = preDest.next;
- }
- Node dest = preDest.next;
- preDest.next = dest.next;
-
- size--;
- return dest.data;
- }
-
- @Override
- public int size() {
- return size;
- }
-
- public void addFirst(Object o) {
- Node node = new Node(o);
- node.next = head;
- head = node;
- size++;
- }
-
- public void addLast(Object o) {
- Node lastNode = head;
- while (lastNode.next != null) {
- lastNode = lastNode.next;
- }
-
- Node node = new Node(o);
- lastNode.next = node;
- size++;
- }
-
- public Object removeFirst() {
- if (head == null) {
- throw new NoSuchElementException();
- }
- Node target = head;
- head = head.next;
- size--;
- return target.data;
- }
-
- public Object removeLast() {
- if (head == null) {
- throw new NoSuchElementException();
- }
-
- Node preDest = head;
- while (preDest.next.next != null) {
- preDest = preDest.next;
- }
- Node dest = preDest.next;
- preDest.next = null;
-
- size--;
- return dest.data;
- }
-
- public Iterator iterator() {
- return null;
- }
-
-
- private static class Node {
- Object data;
- Node next;
-
- Node(Object data) {
- this.data = data;
- next = null;
- }
- }
-}
diff --git a/group01/765324639/src/zavier/week01/basic/List.java b/group01/765324639/src/zavier/week01/basic/List.java
deleted file mode 100644
index 4f2d49bd73..0000000000
--- a/group01/765324639/src/zavier/week01/basic/List.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package zavier.week01.basic;
-
-public interface List {
- public void add(Object o);
-
- public void add(int index, Object o);
-
- public Object get(int index);
-
- public Object remove(int index);
-
- public int size();
-}
diff --git a/group01/765324639/src/zavier/week01/basic/Queue.java b/group01/765324639/src/zavier/week01/basic/Queue.java
deleted file mode 100644
index 5a212d46c1..0000000000
--- a/group01/765324639/src/zavier/week01/basic/Queue.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package zavier.week01.basic;
-
-public class Queue {
-
- private LinkedList list = new LinkedList();
-
- public void enQueue(Object o) {
- list.add(o);
- }
-
- public Object deQueue() {
- if (list.size() == 0) {
- return null;
- }
- return list.removeFirst();
- }
-
- public boolean isEmpty() {
- return list.size() == 0;
- }
-
- public int size() {
- return list.size();
- }
-}
diff --git a/group01/765324639/src/zavier/week01/basic/Stack.java b/group01/765324639/src/zavier/week01/basic/Stack.java
deleted file mode 100644
index ebe4afb19f..0000000000
--- a/group01/765324639/src/zavier/week01/basic/Stack.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package zavier.week01.basic;
-
-import java.util.EmptyStackException;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o) {
- elementData.add(o);
- }
-
- public Object pop() {
- if (elementData.size() == 0) {
- throw new EmptyStackException();
- }
- return elementData.remove(elementData.size() - 1);
- }
-
- public Object peek() {
- if (elementData.size() == 0) {
- throw new EmptyStackException();
- }
- return elementData.get(elementData.size() - 1);
- }
-
- public boolean isEmpty() {
- return elementData.size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-}
diff --git a/group01/765324639/src/zavier/week01/test/AllTests.java b/group01/765324639/src/zavier/week01/test/AllTests.java
deleted file mode 100644
index c1755f6803..0000000000
--- a/group01/765324639/src/zavier/week01/test/AllTests.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package zavier.week01.test;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ArrayListTest.class, LinkedListTest.class, QueueTest.class, StackTest.class,
- BinaryTreeNodeTest.class})
-public class AllTests {
-
-}
diff --git a/group01/765324639/src/zavier/week01/test/ArrayListTest.java b/group01/765324639/src/zavier/week01/test/ArrayListTest.java
deleted file mode 100644
index 6a475500df..0000000000
--- a/group01/765324639/src/zavier/week01/test/ArrayListTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package zavier.week01.test;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import zavier.week01.basic.ArrayList;
-import zavier.week01.basic.Iterator;
-
-public class ArrayListTest {
-
- private ArrayList arrayList = new ArrayList();
-
- @Before
- public void setUp() {
- for (int i = 0; i < 500; i++) {
- arrayList.add(i);
- }
- }
-
- @Test
- public void testAddObject() {
- for (int i = 0; i < 500; i++) {
- arrayList.add(i);
- }
- }
-
- @Test
- public void testAddIntObject() {
- arrayList.add(100, -100);
- Assert.assertEquals(-100, arrayList.get(100));
- Assert.assertEquals(100, arrayList.get(101));
- Assert.assertEquals(501, arrayList.size());
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testAddIllegalIntObject() {
- arrayList.add(1000, 5);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testAddNegativeIntObject() {
- arrayList.add(-1, 5);
- }
-
- @Test
- public void testGet() {
- for (int i = 0; i < 500; i++) {
- Assert.assertEquals(i, ((Integer) arrayList.get(i)).intValue());
- }
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testIllegalGet() {
- arrayList.get(500);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testNegativeGet() {
- arrayList.get(-10);
- }
-
- @Test
- public void testRemove() {
- Assert.assertEquals(100, arrayList.remove(100));
- Assert.assertEquals(101, arrayList.get(100));
- Assert.assertEquals(499, arrayList.size());
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testIllegalRemove() {
- arrayList.remove(500);
- }
-
- @Test
- public void testSize() {
- Assert.assertEquals(500, arrayList.size());
- }
-
- @Test
- public void testIterator() {
- Iterator iterator = arrayList.iterator();
- int i = 0;
- while (iterator.hasNext()) {
- Assert.assertEquals(i, iterator.next());
- i++;
- }
- Assert.assertEquals(500, i);
- }
-
-}
diff --git a/group01/765324639/src/zavier/week01/test/BinaryTreeNodeTest.java b/group01/765324639/src/zavier/week01/test/BinaryTreeNodeTest.java
deleted file mode 100644
index 30a096a350..0000000000
--- a/group01/765324639/src/zavier/week01/test/BinaryTreeNodeTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package zavier.week01.test;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import zavier.week01.basic.BinaryTreeNode;
-
-public class BinaryTreeNodeTest {
-
- private BinaryTreeNode root = new BinaryTreeNode(5);
-
- @Test
- public void testInsert() {
- root.insert(2);
- root.insert(7);
- root.insert(1);
- root.insert(6);
-
- Assert.assertEquals((Integer) 5, root.getData());
- Assert.assertEquals((Integer) 2, root.getLeft().getData());
- Assert.assertEquals((Integer) 1, root.getLeft().getLeft().getData());
- Assert.assertEquals(null, root.getLeft().getRight());
- Assert.assertEquals((Integer) 7, root.getRight().getData());
- Assert.assertEquals((Integer) 6, root.getRight().getLeft().getData());
- Assert.assertEquals(null, root.getRight().getRight());
-
- root.insert(4);
- root.insert(8);
- Assert.assertEquals((Integer) 4, root.getLeft().getRight().getData());
- Assert.assertEquals((Integer) 8, root.getRight().getRight().getData());
- }
-
-}
diff --git a/group01/765324639/src/zavier/week01/test/LinkedListTest.java b/group01/765324639/src/zavier/week01/test/LinkedListTest.java
deleted file mode 100644
index de7436a350..0000000000
--- a/group01/765324639/src/zavier/week01/test/LinkedListTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package zavier.week01.test;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import zavier.week01.basic.LinkedList;
-
-
-public class LinkedListTest {
-
- private LinkedList linkedList = new LinkedList();
-
- @Before
- public void setUp() {
- for (int i = 0; i < 500; i++) {
- linkedList.add(i);
- }
- }
-
- @Test
- public void testAddObject() {
- for (int i = 0; i < 100; i++) {
- linkedList.add(i);
- }
- Assert.assertEquals(600, linkedList.size());
- }
-
- @Test
- public void testAddIntObject() {
- linkedList.add(100, -100);
- Assert.assertEquals(-100, linkedList.get(100));
- Assert.assertEquals(100, linkedList.get(101));
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testAddIllegalIntObject() {
- linkedList.add(1000, 10);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testAddNegativeIntObject() {
- linkedList.add(-10, 10);
- }
-
- @Test
- public void testGet() {
- for (int i = 0; i < 500; i++) {
- Assert.assertEquals(i, ((Integer) linkedList.get(i)).intValue());
- }
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testIllegalGet() {
- linkedList.get(500);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testNegativeGet() {
- linkedList.get(-10);
- }
-
- @Test
- public void testRemove() {
- Assert.assertEquals(100, linkedList.remove(100));
- Assert.assertEquals(101, linkedList.get(100));
- Assert.assertEquals(499, linkedList.size());
- }
-
- @Test
- public void testSize() {
- Assert.assertEquals(500, linkedList.size());
- linkedList.add(10);
- Assert.assertEquals(501, linkedList.size());
- }
-
- @Test
- public void testAddFirst() {
- linkedList.addFirst(-10);
- Assert.assertEquals(-10, linkedList.get(0));
- linkedList.addFirst(-100);
- Assert.assertEquals(-100, linkedList.get(0));
- Assert.assertEquals(-10, linkedList.get(1));
- }
-
- @Test
- public void testAddLast() {
- linkedList.addLast(-9);
- Assert.assertEquals(-9, linkedList.get(linkedList.size() - 1));
- linkedList.addLast(-8);
- Assert.assertEquals(-8, linkedList.get(linkedList.size() - 1));
- Assert.assertEquals(-9, linkedList.get(linkedList.size() - 2));
- }
-
- @Test
- public void testRemoveFirst() {
- Assert.assertEquals(0, linkedList.removeFirst());
- Assert.assertEquals(1, linkedList.removeFirst());
- Assert.assertEquals(498, linkedList.size());
- }
-
- @Test
- public void testRemoveLast() {
- Assert.assertEquals(499, linkedList.removeLast());
- Assert.assertEquals(498, linkedList.removeLast());
- Assert.assertEquals(498, linkedList.size());
- }
-
-}
diff --git a/group01/765324639/src/zavier/week01/test/QueueTest.java b/group01/765324639/src/zavier/week01/test/QueueTest.java
deleted file mode 100644
index 99d6466c8a..0000000000
--- a/group01/765324639/src/zavier/week01/test/QueueTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package zavier.week01.test;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import zavier.week01.basic.Queue;
-
-public class QueueTest {
-
- private Queue queue = new Queue();
-
- @Before
- public void setUp() {
- for (int i = 0; i < 500; i++) {
- queue.enQueue(i);
- }
- }
-
- @Test
- public void testEnQueue() {
- for (int i = 0; i < 100; i++) {
- queue.enQueue(i);
- }
- Assert.assertEquals(600, queue.size());
- }
-
- @Test
- public void testDeQueue() {
- for (int i = 0; i < 500; i++) {
- Assert.assertEquals(i, queue.deQueue());
- }
- Assert.assertNull(queue.deQueue());
- Assert.assertNull(queue.deQueue());
- }
-
- @Test
- public void testIsEmpty() {
- Assert.assertFalse(queue.isEmpty());
- Queue q = new Queue();
- Assert.assertTrue(q.isEmpty());
- }
-
- @Test
- public void testSize() {
- Assert.assertEquals(500, queue.size());
- }
-
-}
diff --git a/group01/765324639/src/zavier/week01/test/StackTest.java b/group01/765324639/src/zavier/week01/test/StackTest.java
deleted file mode 100644
index 8138f97d3d..0000000000
--- a/group01/765324639/src/zavier/week01/test/StackTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package zavier.week01.test;
-
-import java.util.EmptyStackException;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import zavier.week01.basic.Stack;
-
-
-public class StackTest {
-
- private Stack stack = new Stack();
-
- @Before
- public void setUp() {
- for (int i = 0; i < 500; i++) {
- stack.push(i);
- }
- }
-
- @Test
- public void testPush() {
- for (int i = 0; i < 100; i++) {
- stack.push(i);
- }
- Assert.assertEquals(600, stack.size());
- }
-
- @Test(expected = EmptyStackException.class)
- public void testPop() {
- for (int i = 0; i < 500; i++) {
- Assert.assertEquals(499 - i, stack.pop());
- }
- stack.pop();
- }
-
- @Test
- public void testPeek() {
- Assert.assertEquals(499, stack.peek());
- Assert.assertEquals(499, stack.peek());
- stack.pop();
- Assert.assertEquals(498, stack.peek());
- }
-
- @Test
- public void testIsEmpty() {
- Assert.assertFalse(stack.isEmpty());
- Assert.assertTrue(new Stack().isEmpty());
- }
-
- @Test
- public void testSize() {
- Assert.assertEquals(500, stack.size());
- stack.pop();
- Assert.assertEquals(499, stack.size());
- }
-
-}
diff --git a/group01/819048836/lvxg2017/src/basic/BinaryTree.java b/group01/819048836/lvxg2017/src/basic/BinaryTree.java
deleted file mode 100644
index f966389ea5..0000000000
--- a/group01/819048836/lvxg2017/src/basic/BinaryTree.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package basic;
-
-public class BinaryTree {
- private BinaryTreeNode root;//根节点
-
- //插入操作
- public void insert(int value){
- BinaryTreeNode newNode = new BinaryTreeNode(value);
- if(root==null){
- root = newNode;
- root.setLeft(null);
- root.setRight(null);
- }else{
- BinaryTreeNode currentNode = root;
- BinaryTreeNode parentNode;
- while(true)
- {
- parentNode = currentNode;
- //往右放
- if(newNode.getData()>currentNode.getData()){
- currentNode = currentNode.getRight();
- if(currentNode ==null){
- parentNode.setRight(newNode);
- return;
- }
- }else if(newNode.getData()<=currentNode.getData()){
- currentNode = currentNode.getLeft();
- if(currentNode ==null){
- parentNode.setLeft(newNode);
- return;
- }
- }
-
- }
-
- }
-
-
- }
-
-}
diff --git a/group01/819048836/lvxg2017/src/basic/BinaryTreeNode.java b/group01/819048836/lvxg2017/src/basic/BinaryTreeNode.java
deleted file mode 100644
index 7f984b6131..0000000000
--- a/group01/819048836/lvxg2017/src/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package basic;
-
-//������
-public class BinaryTreeNode {
- private int data;//节点值
- private BinaryTreeNode left; //左子节点
- private BinaryTreeNode right;//右子节点
- public BinaryTreeNode(int data){
- this.data =data;
- this.left = null;
- this.right = null;
- }
- public void setDate(int data){
- this.data =data;
- }
- public int getData(){
- return data;
- }
- public BinaryTreeNode getLeft(){
- return left;
- }
- public BinaryTreeNode getRight(){
- return right;
- }
- public void setLeft(BinaryTreeNode left){
- this.left = left;
- }
- public void setRight(BinaryTreeNode right){
- this.right =right;
- }
-
-
-
-}
diff --git a/group01/819048836/lvxg2017/src/basic/MyArrayList.java b/group01/819048836/lvxg2017/src/basic/MyArrayList.java
deleted file mode 100644
index 064acf941e..0000000000
--- a/group01/819048836/lvxg2017/src/basic/MyArrayList.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package basic;
-/**
- *
- *
- * @author lvxg
- *
- */
-public class MyArrayList {
- private Object[] element;
- private int size;
- private static final Object[] EMPTY = new Object[10];
-
- public MyArrayList() {
- this.element = EMPTY;
- }
-
- public boolean add(Object o) {
- if (size < element.length) {
- element[size] = o;
- size++;
- } else {
- //数组扩容
- grow();
- element[size] = o;
- size++;
- }
- return true;
- }
-
- //根据索引添加
- public boolean add(int index, Object o) {
- rangeCheckForAdd(index);
- if (size < element.length + 1) {
- Object[] e = new Object[element.length+1];
- System.arraycopy(element, 0, e, 0, index);
- e[index] = o;
- System.arraycopy(element, index, e, index + 1, element.length-index);
- element = e;
- size++;
- }
- return true;
- }
-
- public Object get(int index) {
- rangeCheck(index);
- return element[index];
- }
-
- public Object remove(int index) {
- rangeCheck(index);
- Object oldValue = element[index];
- int numMoved = size - index-1;
- if(numMoved>0){
- System.arraycopy(element, index+1, element, index, numMoved);
- }
- element[--size] =null;
- return oldValue;
- }
- public int size() {
- return size;
- }
- private void rangeCheck(int index) {
- if (index >= size)
- throw new IndexOutOfBoundsException();
- }
- private void rangeCheckForAdd(int index) {
- if (index > size || index < 0) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- //数组扩容方法
- private void grow() {
- Object[] e = new Object[size * 2];
- System.arraycopy(element, 0, e, 0, element.length);
- element = e;
-
- }
-
- public static void main(String[] args) {
- MyArrayList m = new MyArrayList();
- for (int i = 0; i < 10; i++) {
- m.add(i);
- }
- m.add(2, "123");
- }
-
-}
diff --git a/group01/819048836/lvxg2017/src/basic/MyLinkedList.java b/group01/819048836/lvxg2017/src/basic/MyLinkedList.java
deleted file mode 100644
index c79c0e1b81..0000000000
--- a/group01/819048836/lvxg2017/src/basic/MyLinkedList.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package basic;
-
-
-
-/**
- * 链表
- *
- * @author lvxg
- *
- */
-public class MyLinkedList {
- // 头节点
- private Node first;
- // 尾节点
- private Node last;
- // 链表长度
- private int size = 0;
-
- public boolean add(Object o) {
- linklast(o);
- return true;
- }
- /**
- * 根据索引添加节点
- * @param index
- * @param o
- */
- public void add(int index, Object o) {
- checkPositionIndex(index);
- if (index == size) {
- linklast(o);
- } else {
- final Node succ = node(index);
- final Node pred = succ.prev;
- Node newNode = new Node(o, pred, succ);
- if (pred == null) {
- first = newNode;
- } else {
- pred.next = newNode;
- }
- size++;
- }
- }
- //根据索引删除节点
- private Object remove(int index){
- Object x= unllink(node(index));
- return x;
- }
- private Object remove(){
- Object x = unllink(node(size));
- return x;
- }
- @SuppressWarnings("unused")
- private Object get(int index)
- {
- Node f = first;
- for (int i = 0; i < index; i++) {
- f = f.next;
- }
- return f.data;
- }
- @SuppressWarnings("unused")
- private int size(){
- return size;
- }
- @SuppressWarnings("unused")
- private void addFirst(Object o){
- Node f= first;
- Node newNode = new Node(o, f, null);
- f.prev = newNode;
- first = newNode;
- }
- @SuppressWarnings("unused")
- private void addLast(Object o){
- Node l = last;
- Node newNode = new Node(o, null, l);
- l.next = newNode;
- last = newNode;
- }
- public Object removeFirst(){
- return null;
- }
- public Object removeLast(){
- return null;
- }
-
- private void linklast(Object e) {
- final Node l = last;
- final Node newNode = new Node(e, null, l);
- last = newNode;
- if (l == null) {
- first = newNode;
- } else {
- l.next = newNode;
- }
- size++;
-
- }
-
- private Object unllink(Node x) {
- final Object element = x.data;
- final Node next = x.next;
- final Node prev = x.prev;
- if (prev == null) {
- first = next;
- } else {
- prev.next = next;
- x.next = null;
- x.prev = null;
- }
- if (next == null) {
- last = prev;
- x.next = null;
- }
- size--;
- x.data = null;
- return element;
- }
-
- private Node node(int index) {
- if (index < (size >> 1)) {
- Node x = first;
- for (int i = 0; i < index; i++) {
- x = x.next;
- }
- return x;
- } else {
- Node x = last;
- for (int i = size - 1; i > index; i--) {
- x = x.prev;
- }
- return x;
- }
- }
-
- private static class Node {
- Object data; // 节点值
- Node next;// 后继节点
- Node prev;// 前驱节点
-
- public Node(Object o, Node n, Node p) {
- this.data = o;
- this.prev = p;
- this.next = n;
- }
- }
-
- private void checkPositionIndex(int index) {
- if (!isPositionIndex(index)) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- private boolean isPositionIndex(int index) {
- return index >= 0 && index <= size;
- }
-
- public static void main(String[] args) {
- MyLinkedList l = new MyLinkedList();
- l.add("1");
- l.add("2");
- l.add("3");
- l.add(2, "4");
- l.remove();
- l.remove(1);
- }
-
-}
diff --git a/group01/819048836/lvxg2017/src/basic/Queue.java b/group01/819048836/lvxg2017/src/basic/Queue.java
deleted file mode 100644
index e29bf6fa4f..0000000000
--- a/group01/819048836/lvxg2017/src/basic/Queue.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package basic;
-
-public class Queue {
- private Node first;
- private Node last;
- private int size = 0;
-
- //入列
- @SuppressWarnings("unused")
- private void enQueue(Object o) {
- final Node f = first;
- final Node newNode = new Node(o, f, null);
- f.prev = newNode;
- }
- public int size(){
- return size;
- }
-public boolean isEmpty(){
- return size>=0;
-}
- // 出列
- @SuppressWarnings("unused")
- private Object deQueue() {
- final Node l = last;
- final Node p = l.prev;
- last = p;
- p.next = null;
- return l;
- }
-
- private static class Node {
- Object data;
- Node next;
- Node prev;
-
- public Node(Object o, Node n, Node p) {
- this.data = o;
- this.prev = p;
- this.next = n;
- }
- }
-
-}
diff --git a/group01/819048836/lvxg2017/src/basic/Stack.java b/group01/819048836/lvxg2017/src/basic/Stack.java
deleted file mode 100644
index 916eac298a..0000000000
--- a/group01/819048836/lvxg2017/src/basic/Stack.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package basic;
-
-//ջ
-public class Stack {
- private Node first;
- private Node last;
- private int size = 0;
-
- // 出栈
- private void pop() {
- removeLast();
- }
-
- // 入栈
- private void push(Object o) {
- addLast(o);
- }
- private boolean isEmpty(){
- if(size==0){
- return true;
- }else{
- return false;
- }
- }
- private int size(){
- return size;
- }
- private void removeLast(){
- final Node f = last.prev;
- last = f;
- f.next =null;
- }
-
-
- private void addLast(Object o){
- final Node f= first;
- final Node l = last;
- final Node newNode = new Node(o, last, null);
- if(f==null){
- first =newNode;
- }else{
- l.next = newNode;
- }
- size++;
- }
-
- private static class Node {
- Object data;
- Node next;
- Node prev;
-
- public Node(Object o, Node n, Node p) {
- this.data = o;
- this.prev = p;
- this.next = n;
- }
- }
-}
diff --git a/group01/895457260/code/src/datastructure/basic/ArrayList.java b/group01/895457260/code/src/datastructure/basic/ArrayList.java
deleted file mode 100644
index 28eb439c1b..0000000000
--- a/group01/895457260/code/src/datastructure/basic/ArrayList.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package datastructure.basic;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData;
-
- public ArrayList() {
- elementData = new Object[100];
- }
-
- public ArrayList(int initCapacity) {
- elementData = new Object[initCapacity];
- }
-
- public void add(Object o) {
- autoGrow();
- elementData[size()] = o;
- size++;
- }
-
- public void add(int index, Object o) {
- autoGrow();
- System.arraycopy(elementData, index, elementData, index + 1, size() - index);
- elementData[index] = o;
- size++;
- }
-
- public Object get(int index) {
- checkIndex(index);
- return elementData[index];
- }
-
- public Object remove(int index) {
- checkIndex(index);
- Object removed = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size() - index - 1);
- size--;
- return removed;
- }
-
- public int size() {
- return size;
- }
-
- public Iterator iterator() {
- return new Iterator() {
- int index = -1;
- @Override
- public boolean hasNext() {
- return index + 1 < size();
- }
-
- @Override
- public Object next() {
- index++;
- return elementData[index];
- }
- };
- }
-
- private void autoGrow() {
- if (size >= elementData.length) {
- Object[] newArray = new Object[nextCapacity()];
- System.arraycopy(elementData, 0, newArray, 0, elementData.length);
- elementData = newArray;
- }
- }
-
- private int nextCapacity() {
- return elementData.length * 2;
- }
-
- private void checkIndex(int index) {
- if (index >= size() || index < 0) {
- throw new IndexOutOfBoundsException(indexOutOfBoundMessage(index));
- }
- }
-
- private String indexOutOfBoundMessage(int index) {
- return "index: " + index + ", size: " + size();
- }
-
- public static void main(String[] args) {
- ArrayList list = new ArrayList();
- for (int i = 0; i < 10; ++i) {
- list.add(i);
- list.add(10 - i);
- }
- System.out.println("------------------size");
- System.out.println("size: " + list.size());
-
- System.out.println("------------------for(int i)");
- for (int i = 0; i < list.size(); ++i) {
- System.out.print(list.get(i) + " ");
- }
-
- System.out.println("\n-----------------iterator");
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- System.out.print(iterator.next() + " ");
- }
-
- System.out.println("\n-----------------add at index 0 100~104");
- for (int i = 100; i < 105; ++i) {
- list.add(0, i);
- }
- list.print();
- System.out.println("-----------------add at last 200~204");
- for (int i = 200; i < 205; ++i) {
- list.add(list.size(), i);
- }
- list.print();
-
- System.out.println("-----------------removeFirst x4");
- for (int i = 0; i < 4; ++i) {
- list.remove(0);
- }
- list.print();
-
- System.out.println("\n-----------------removeLast x4");
- for (int i = 0; i < 4; ++i) {
- list.remove(list.size() - 1);
- }
- list.print();
- }
-
- public void print() {
- Iterator iterator = iterator();
- while (iterator.hasNext()) {
- System.out.print(iterator.next() + " ");
- }
- System.out.println("\nsize: " + size());
- }
-}
diff --git a/group01/895457260/code/src/datastructure/basic/BinarySortedTree.java b/group01/895457260/code/src/datastructure/basic/BinarySortedTree.java
deleted file mode 100644
index b251ff02ee..0000000000
--- a/group01/895457260/code/src/datastructure/basic/BinarySortedTree.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package datastructure.basic;
-
-/**
- * Created by Haochen on 2017/2/24.
- * TODO:
- */
-public class BinarySortedTree {
-
- private BinaryTreeNode root = null;
-
- public void traverse(Visitor visitor) {
- traverse(root, visitor);
- }
-
- private void traverse(BinaryTreeNode node, Visitor visitor) {
- if (node == null) {
- return;
- }
- traverse(node.getLeft(), visitor);
- visitor.visit(node);
- traverse(node.getRight(), visitor);
- }
-
- public interface Visitor {
- void visit(BinaryTreeNode node);
- }
-
- //不递归的写法
- public void add(T o) {
- //根节点空,直接加入
- if (root == null) {
- root = new BinaryTreeNode();
- root.setData(o);
- } else {
- BinaryTreeNode target = root;
- //从根结点不断向下比较target和o,o小则往左,o大则往右,相等不加入
- while (true) {
- int compare = o.compareTo(target.getData());
- if (compare == 0) {//相等不加入
- return;
- } else if (compare < 0) {//o小往左
- if (target.getLeft() == null) {//左空则加入
- target.setLeft(new BinaryTreeNode());
- target.getLeft().setData(o);
- return;
- } else {//不空继续比较
- target = target.getLeft();
- }
- } else {//o大往右
- if (target.getRight() == null) {
- target.setRight(new BinaryTreeNode());
- target.getRight().setData(o);
- return;
- } else {
- target = target.getRight();
- }
- }
- }
- }
- }
-}
diff --git a/group01/895457260/code/src/datastructure/basic/BinaryTreeNode.java b/group01/895457260/code/src/datastructure/basic/BinaryTreeNode.java
deleted file mode 100644
index d3a9ff377b..0000000000
--- a/group01/895457260/code/src/datastructure/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package datastructure.basic;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
diff --git a/group01/895457260/code/src/datastructure/basic/Iterator.java b/group01/895457260/code/src/datastructure/basic/Iterator.java
deleted file mode 100644
index c1fb7ae8a5..0000000000
--- a/group01/895457260/code/src/datastructure/basic/Iterator.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package datastructure.basic;
-
-public interface Iterator {
- boolean hasNext();
- Object next();
-}
diff --git a/group01/895457260/code/src/datastructure/basic/LinkedList.java b/group01/895457260/code/src/datastructure/basic/LinkedList.java
deleted file mode 100644
index 174044c546..0000000000
--- a/group01/895457260/code/src/datastructure/basic/LinkedList.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package datastructure.basic;
-
-import datastructure.exception.EmptyListException;
-
-public class LinkedList implements List {
-
- private Node head;
- private int size;
-
- public LinkedList() {
- head = new Node();
- }
-
- @Override
- public void add(Object o) {
- addLast(o);
- }
-
- @Override
- public void add(int index , Object o) {
- Node pre = findNode(index - 1);
- Node node = new Node();
- node.data = o;
- addNode(node, pre);
- }
-
- @Override
- public Object get(int index) {
- checkIndex(index);
- return findNode(index).data;
- }
-
- @Override
- public Object remove(int index) {
- checkIndex(index);
- Node pre = findNode(index - 1);
- Node removed = pre.next;
- removeNode(removed, pre);
- return removed.data;
- }
-
- @Override
- public int size() {
- return size;
- }
-
- public void addFirst(Object o) {
- Node node = new Node();
- node.data = o;
- addNode(node, head);
- }
-
- public void addLast(Object o) {
- Node node = new Node();
- node.data = o;
- Node pre = findNode(size() - 1);
- addNode(node, pre);
- }
-
- public Object removeFirst() {
- if (size() == 0) {
- throw new EmptyListException();
- }
- Node removed = head.next;
- removeNode(head.next, head);
- return removed.data;
- }
-
- public Object removeLast() {
- if (size() == 0) {
- throw new EmptyListException();
- }
- return remove(size() - 1);
- }
-
- @Override
- public Iterator iterator() {
- return new Iterator() {
- Node node = head;
- @Override
- public boolean hasNext() {
- return node.next != null;
- }
-
- @Override
- public Object next() {
- node = node.next;
- return node.data;
- }
- };
- }
-
- private static class Node{
- Object data;
- Node next;
- }
-
- private Node findNode(int index) {
- if (index == -1) {
- return head;
- } else {
- checkIndex(index);
- }
- Node node = head.next;
- for (int i = 0; i < index; ++i) {
- node = node.next;
- }
- return node;
- }
-
- private void checkIndex(int index) {
- if (index >= size() || index < 0) {
- throw new IndexOutOfBoundsException(indexOutOfBoundMessage(index));
- }
- }
-
- private String indexOutOfBoundMessage(int index) {
- return "index: " + index + ", size: " + size();
- }
-
- private void addNode(Node node, Node pre) {
- node.next = pre.next;
- pre.next = node;
- size++;
- }
-
- private void removeNode(Node node, Node pre) {
- pre.next = node.next;
- node.next = null;
- size--;
- }
-}
diff --git a/group01/895457260/code/src/datastructure/basic/List.java b/group01/895457260/code/src/datastructure/basic/List.java
deleted file mode 100644
index 2f085701c5..0000000000
--- a/group01/895457260/code/src/datastructure/basic/List.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package datastructure.basic;
-
-public interface List {
- void add(Object o);
- void add(int index, Object o);
- Object get(int index);
- Object remove(int index);
- int size();
- Iterator iterator();
-}
diff --git a/group01/895457260/code/src/datastructure/basic/Queue.java b/group01/895457260/code/src/datastructure/basic/Queue.java
deleted file mode 100644
index edd0a6a29e..0000000000
--- a/group01/895457260/code/src/datastructure/basic/Queue.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package datastructure.basic;
-
-import datastructure.exception.EmptyQueueException;
-
-public class Queue {
- //数组实现自增长的循环队列
- private Object[] array;
- private int head = 0;
- private int rear = 0;
-
- public Queue() {
- this.array = new Object[10];
- }
-
- public Queue(int initCapacity) {
- this.array = new Object[initCapacity];
- }
-
- public void enQueue(Object o) {
- int target = mapIndex(rear);
- autoGrow();
- array[target] = o;
- rear++;
- }
-
- public Object deQueue() {
- if (isEmpty()) {
- throw new EmptyQueueException();
- }
- Object obj = array[mapIndex(head)];
- head++;
- return obj;
- }
-
- public boolean isEmpty() {
- return head == rear;
- }
-
- public int size() {
- return rear - head;
- }
-
- private int capacity() {
- return array.length;
- }
-
- private void autoGrow() {
- if (size() >= capacity()) {
- Object[] newArray = new Object[nextCapacity()];
- System.arraycopy(array, 0, newArray, 0, capacity());
-
- int increase = nextCapacity() - capacity();
- int moveCount = size() - mapIndex(rear);
- System.arraycopy(newArray, mapIndex(head), newArray, mapIndex(head) + increase, moveCount);
- array = newArray;
- head += increase;
- rear += increase;
- }
- }
-
- private int nextCapacity() {
- return capacity() * 2;
- }
-
- private int mapIndex(int index) {
- return index >= capacity() ? index % capacity() : index;
- }
-}
diff --git a/group01/895457260/code/src/datastructure/basic/Stack.java b/group01/895457260/code/src/datastructure/basic/Stack.java
deleted file mode 100644
index ab4fc874ae..0000000000
--- a/group01/895457260/code/src/datastructure/basic/Stack.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package datastructure.basic;
-
-import java.util.EmptyStackException;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o) {
- elementData.add(o);
- }
-
- public Object pop() {
- if (isEmpty()) {
- throw new EmptyStackException();
- }
- Object peek = peek();
- elementData.remove(elementData.size() - 1);
- return peek;
- }
-
- public Object peek() {
- return elementData.get(elementData.size() - 1);
- }
-
- public boolean isEmpty() {
- return size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-}
diff --git a/group01/895457260/code/src/datastructure/exception/EmptyListException.java b/group01/895457260/code/src/datastructure/exception/EmptyListException.java
deleted file mode 100644
index 6f38ed6c43..0000000000
--- a/group01/895457260/code/src/datastructure/exception/EmptyListException.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package datastructure.exception;
-
-/**
- * Created by Haochen on 2017/2/24.
- * TODO:
- */
-public class EmptyListException extends RuntimeException {
-}
diff --git a/group01/895457260/code/src/datastructure/exception/EmptyQueueException.java b/group01/895457260/code/src/datastructure/exception/EmptyQueueException.java
deleted file mode 100644
index 071a366ed8..0000000000
--- a/group01/895457260/code/src/datastructure/exception/EmptyQueueException.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package datastructure.exception;
-
-/**
- * Created by Haochen on 2017/2/24.
- * TODO:
- */
-public class EmptyQueueException extends RuntimeException {}
diff --git a/group01/895457260/code/src/test/datastructure/basic/ArrayListTest.java b/group01/895457260/code/src/test/datastructure/basic/ArrayListTest.java
deleted file mode 100644
index 42b9144d38..0000000000
--- a/group01/895457260/code/src/test/datastructure/basic/ArrayListTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package test.datastructure.basic;
-
-import datastructure.basic.ArrayList;
-import datastructure.basic.Iterator;
-import datastructure.basic.List;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
-
-/**
- * ArrayList Tester.
- *
- * @author
- * @version 1.0
- * @since 二月 24, 2017
- */
-public class ArrayListTest {
-
- @Before
- public void before() throws Exception {
- }
-
- @After
- public void after() throws Exception {
- }
-
- protected final List getList() {
- List list = createList();
- init(list);
- return list;
- }
-
- List createList() {
- return new ArrayList(5);
- }
-
- private void init(List list) {
- for (int i = 1; i <= 5; ++i) {
- list.add(i);
- }
- }
-
- protected final Object[] toArray(List list) {
- Object[] array = new Object[list.size()];
- Iterator iterator = list.iterator();
- int pos = 0;
- while (iterator.hasNext()) {
- array[pos++] = iterator.next();
- }
- return array;
- }
-
- /**
- * Method: add(Object o)
- */
- @Test
- public void testAddO() throws Exception {
-//TODO: Test goes here...
- List list = getList();
- for (int i = 6; i <= 10; ++i) {
- list.add(i);
- }
- Assert.assertArrayEquals(toArray(list), new Object[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
- Assert.assertEquals(list.size(), 10);
- }
-
- /**
- * Method: add(int index, Object o)
- */
- @Test
- public void testAddForIndexO() throws Exception {
-//TODO: Test goes here...
- List list = getList();
- int nowSize = list.size();
- int[] indexes = {nowSize + 1, -1, nowSize, nowSize, 0, 1};
- Object[] values = {0, 0, 300, 400, 100, 200};
- boolean[] exceptions = new boolean[indexes.length];
- for (int i = 0; i < indexes.length; ++i) {
- try {
- list.add(indexes[i], values[i]);
- } catch (IndexOutOfBoundsException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(toArray(list), new Object[]{100, 200, 1, 2, 3, 4, 5, 400, 300});
- Assert.assertArrayEquals(exceptions, new boolean[]{true, true, false, false, false, false});
- Assert.assertEquals(list.size(), nowSize + 4);
- }
-
- /**
- * Method: get(int index)
- */
- @Test
- public void testGet() throws Exception {
-//TODO: Test goes here...
- List list = getList();
- int nowSize = list.size();
- int[] indexes = {-1, nowSize, 0, 1, nowSize - 1, nowSize - 2};
- Object[] values = new Object[indexes.length];
- boolean[] exceptions = new boolean[indexes.length];
- for (int i = 0; i < indexes.length; ++i) {
- try {
- values[i] = list.get(indexes[i]);
- } catch (IndexOutOfBoundsException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(values, new Object[]{null, null, 1, 2, 5, 4});
- Assert.assertArrayEquals(exceptions, new boolean[]{true, true, false, false, false, false});
- Assert.assertEquals(list.size(), nowSize);
- }
-
- /**
- * Method: remove(int index)
- */
- @Test
- public void testRemove() throws Exception {
-//TODO: Test goes here...
- List list = getList();
- int nowSize = list.size();
- int[] indexes = {-1, nowSize, nowSize - 2, nowSize - 2, 1, 0};
- Object[] values = new Object[indexes.length];
- boolean[] exceptions = new boolean[indexes.length];
- for (int i = 0; i < indexes.length; ++i) {
- try {
- values[i] = list.remove(indexes[i]);
- } catch (IndexOutOfBoundsException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(values, new Object[]{null, null, 4, 5, 2, 1});
- Assert.assertArrayEquals(exceptions, new boolean[]{true, true, false, false, false, false});
- Assert.assertEquals(list.size(), nowSize - 4);
- }
-
- /**
- * Method: iterator()
- */
- @Test
- public void testIterator() throws Exception {
-//TODO: Test goes here...
- List list = getList();
- Iterator iterator = list.iterator();
- Object[] values = new Object[list.size()];
- int pos = 0;
- while (iterator.hasNext()) {
- values[pos++] = iterator.next();
- }
- Assert.assertArrayEquals(values, new Object[]{1, 2, 3, 4, 5});
- }
-}
diff --git a/group01/895457260/code/src/test/datastructure/basic/BinarySortedTreeTest.java b/group01/895457260/code/src/test/datastructure/basic/BinarySortedTreeTest.java
deleted file mode 100644
index ce15d5622c..0000000000
--- a/group01/895457260/code/src/test/datastructure/basic/BinarySortedTreeTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package test.datastructure.basic;
-
-import datastructure.basic.BinarySortedTree;
-import datastructure.basic.BinaryTreeNode;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
-
-/**
- * BinarySortedTree Tester.
- *
- * @author
- * @version 1.0
- * @since 二月 24, 2017
- */
-public class BinarySortedTreeTest {
-
- @Before
- public void before() throws Exception {
- }
-
- @After
- public void after() throws Exception {
- }
-
- private BinarySortedTree getTree() {
- return new BinarySortedTree<>();
- }
-
- /**
- * Method: add(T o)
- */
- @Test
- public void testAdd() throws Exception {
-//TODO: Test goes here...
- BinarySortedTree tree = getTree();
- int[] addValues = {5, 3, 1, 7, 6, 4, 8};
- for (int i : addValues) {
- tree.add(i);
- }
-
- final Object[] left = new Object[addValues.length];
- final Object[] value = new Object[addValues.length];
- final Object[] right = new Object[addValues.length];
- tree.traverse(new BinarySortedTree.Visitor() {
- int pos = 0;
- @Override
- public void visit(BinaryTreeNode node) {
- left[pos] = node.getLeft() == null ? null : (int) node.getLeft().getData();
- value[pos] = node.getData();
- right[pos] = node.getRight() == null ? null : (int) node.getRight().getData();
- pos++;
- }
- });
- Assert.assertArrayEquals(left, new Object[]{null, 1, null, 3, null, 6, null});
- Assert.assertArrayEquals(value, new Object[]{1, 3, 4, 5, 6, 7, 8});
- Assert.assertArrayEquals(right, new Object[]{null, 4, null, 7, null, 8, null});
- }
-}
diff --git a/group01/895457260/code/src/test/datastructure/basic/LinkedListTest.java b/group01/895457260/code/src/test/datastructure/basic/LinkedListTest.java
deleted file mode 100644
index 0ab03eb589..0000000000
--- a/group01/895457260/code/src/test/datastructure/basic/LinkedListTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package test.datastructure.basic;
-
-import datastructure.exception.EmptyListException;
-import datastructure.basic.LinkedList;
-import datastructure.basic.List;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * LinkedList Tester.
- *
- * @author
- * @version 1.0
- * @since 二月 24, 2017
- */
-public class LinkedListTest extends ArrayListTest {
-
- @Override
- List createList() {
- return new LinkedList();
- }
-
- /**
- * Method: addFirst(Object o)
- */
- @Test
- public void testAddFirst() throws Exception {
-//TODO: Test goes here...
- LinkedList list = (LinkedList) getList();
- list.addFirst(100);
- Assert.assertArrayEquals(toArray(list), new Object[]{100, 1, 2, 3, 4, 5});
- }
-
- /**
- * Method: addLast(Object o)
- */
- @Test
- public void testAddLast() throws Exception {
-//TODO: Test goes here...
- LinkedList list = (LinkedList) getList();
- list.addLast(100);
- Assert.assertArrayEquals(toArray(list), new Object[]{1, 2, 3, 4, 5, 100});
- }
-
- /**
- * Method: removeFirst()
- */
- @Test
- public void testRemoveFirst() throws Exception {
-//TODO: Test goes here...
- LinkedList list = (LinkedList) getList();
- int count = list.size() + 2;
- Object[] values = new Object[count];
- boolean[] exceptions = new boolean[count];
- for (int i = 0; i < count; ++i) {
- try {
- values[i] = list.removeFirst();
- } catch (EmptyListException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(values, new Object[]{1, 2, 3, 4, 5, null, null});
- Assert.assertArrayEquals(exceptions, new boolean[]{false, false, false, false, false, true, true});
- Assert.assertArrayEquals(toArray(list), new Object[0]);
- }
-
- /**
- * Method: removeLast()
- */
- @Test
- public void testRemoveLast() throws Exception {
-//TODO: Test goes here...
- LinkedList list = (LinkedList) getList();
- int count = list.size() + 2;
- Object[] values = new Object[count];
- boolean[] exceptions = new boolean[count];
- for (int i = 0; i < count; ++i) {
- try {
- values[i] = list.removeLast();
- } catch (EmptyListException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(values, new Object[]{5, 4, 3, 2, 1, null, null});
- Assert.assertArrayEquals(exceptions, new boolean[]{false, false, false, false, false, true, true});
- Assert.assertArrayEquals(toArray(list), new Object[0]);
- }
-}
diff --git a/group01/895457260/code/src/test/datastructure/basic/QueueTest.java b/group01/895457260/code/src/test/datastructure/basic/QueueTest.java
deleted file mode 100644
index df7587bd3c..0000000000
--- a/group01/895457260/code/src/test/datastructure/basic/QueueTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package test.datastructure.basic;
-
-import datastructure.exception.EmptyQueueException;
-import datastructure.basic.Queue;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Queue Tester.
- *
- * @author
- * @version 1.0
- * @since 二月 24, 2017
- */
-public class QueueTest {
-
- @Before
- public void before() throws Exception {
- }
-
- @After
- public void after() throws Exception {
- }
-
- private Queue getQueue() {
- Queue queue = new Queue(5);
- for (int i = 1; i <= 5; ++i) {
- queue.enQueue(i);
- }
- return queue;
- }
-
- private void assertQueue(Queue queue, Object[] actual) {
- Class clazz = Queue.class;
- Object[] array = null;
- int head = 0;
- int rear = 0;
- Method mapIndex = null;
- try {
- Field arrayField = clazz.getDeclaredField("array");
- Field headField = clazz.getDeclaredField("head");
- Field rearField = clazz.getDeclaredField("rear");
- mapIndex = clazz.getDeclaredMethod("mapIndex", int.class);
- arrayField.setAccessible(true);
- headField.setAccessible(true);
- rearField.setAccessible(true);
- mapIndex.setAccessible(true);
- array = (Object[]) arrayField.get(queue);
- head = (int) headField.get(queue);
- rear = (int) rearField.get(queue);
- } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
- e.printStackTrace();
- }
- int size = queue.size();
- Object[] excepted = new Object[size];
- int pos = 0;
- try {
- while (head < rear) {
- excepted[pos++] = array[(int) mapIndex.invoke(queue, head)];
- head++;
- }
- } catch (IllegalAccessException | InvocationTargetException e) {
- e.printStackTrace();
- }
- Assert.assertArrayEquals(excepted, actual);
- }
-
- /**
- * Method: enQueue(Object o)
- */
- @Test
- public void testEnQueue() throws Exception {
-//TODO: Test goes here...
- Queue queue = getQueue();
- for (int i = 6; i <= 10; ++i) {
- queue.enQueue(i);
- }
- assertQueue(queue, new Object[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
- }
-
- /**
- * Method: deQueue()
- */
- @Test
- public void testDeQueue() throws Exception {
-//TODO: Test goes here...
- Queue queue = getQueue();
- int count = queue.size() + 2;
- Object[] values = new Object[count];
- boolean[] exceptions = new boolean[count];
- for (int i = 0; i < count; ++i) {
- try {
- values[i] = queue.deQueue();
- } catch (EmptyQueueException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(values, new Object[]{1, 2, 3, 4, 5, null, null});
- Assert.assertArrayEquals(exceptions, new boolean[]{false, false, false, false, false, true, true});
- assertQueue(queue, new Object[0]);
- }
-}
diff --git a/group01/895457260/code/src/test/datastructure/basic/StackTest.java b/group01/895457260/code/src/test/datastructure/basic/StackTest.java
deleted file mode 100644
index ac2bd31a22..0000000000
--- a/group01/895457260/code/src/test/datastructure/basic/StackTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package test.datastructure.basic;
-
-import datastructure.basic.*;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
-
-import java.lang.reflect.Field;
-import java.util.EmptyStackException;
-
-/**
- * Stack Tester.
- *
- * @author
- * @version 1.0
- * @since 二月 24, 2017
- */
-public class StackTest {
-
- @Before
- public void before() throws Exception {
- }
-
- @After
- public void after() throws Exception {
- }
-
- private Stack getStack() {
- Stack stack = new Stack();
- for (int i = 1; i <= 5; ++i) {
- stack.push(i);
- }
- return stack;
- }
-
- private void assertStack(Stack stack, Object[] actual) {
- Class clazz = Stack.class;
- ArrayList elementData = null;
- try {
- Field field = clazz.getDeclaredField("elementData");
- field.setAccessible(true);
- elementData = (ArrayList) field.get(stack);
- } catch (NoSuchFieldException | IllegalAccessException e) {
- e.printStackTrace();
- }
-
- Object[] excepted = null;
- if (elementData != null) {
- int size = stack.size();
- excepted = new Object[size];
- for (int i = 0; i < size; ++i) {
- excepted[i] = elementData.get(i);
- }
- }
- Assert.assertArrayEquals(excepted, actual);
- }
-
- /**
- * Method: push(Object o)
- */
- @Test
- public void testPush() throws Exception {
-//TODO: Test goes here...
- Stack stack = getStack();
- for (int i = 6; i <= 10; ++i) {
- stack.push(i);
- }
- assertStack(stack, new Object[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
- }
-
- /**
- * Method: pop()
- */
- @Test
- public void testPop() throws Exception {
-//TODO: Test goes here...
- Stack stack = getStack();
- int count = stack.size() + 2;
- Object[] values = new Object[count];
- boolean[] exceptions = new boolean[count];
- for (int i = 0; i < count; ++i) {
- try {
- values[i] = stack.pop();
- } catch (EmptyStackException e) {
- exceptions[i] = true;
- }
- }
- Assert.assertArrayEquals(values, new Object[]{5, 4, 3, 2, 1, null, null});
- Assert.assertArrayEquals(exceptions, new boolean[]{false, false, false, false, false, true, true});
- assertStack(stack, new Object[0]);
- }
-}
diff --git a/group01/895457260/code/src/test/datastructure/basic/TestSuite.java b/group01/895457260/code/src/test/datastructure/basic/TestSuite.java
deleted file mode 100644
index f7c5868383..0000000000
--- a/group01/895457260/code/src/test/datastructure/basic/TestSuite.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package test.datastructure.basic;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Created by Haochen on 2017/2/24.
- * TODO:
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({ArrayListTest.class, LinkedListTest.class,
- BinarySortedTreeTest.class, QueueTest.class, StackTest.class})
-public class TestSuite {}
diff --git a/group01/932573198/20170220/.classpath b/group01/932573198/20170220/.classpath
deleted file mode 100644
index b387714202..0000000000
--- a/group01/932573198/20170220/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/group01/932573198/20170220/.gitignore b/group01/932573198/20170220/.gitignore
deleted file mode 100644
index 65776c32fc..0000000000
--- a/group01/932573198/20170220/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
\ No newline at end of file
diff --git a/group01/932573198/20170220/.project b/group01/932573198/20170220/.project
deleted file mode 100644
index 82b0a5ccfd..0000000000
--- a/group01/932573198/20170220/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- 20170220
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/group01/932573198/20170220/.settings/org.eclipse.jdt.core.prefs b/group01/932573198/20170220/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index bb35fa0a87..0000000000
--- a/group01/932573198/20170220/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-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/group01/932573198/20170220/src/com/coding/basic/ArrayList.java b/group01/932573198/20170220/src/com/coding/basic/ArrayList.java
deleted file mode 100644
index 039e83f095..0000000000
--- a/group01/932573198/20170220/src/com/coding/basic/ArrayList.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.coding.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[10];
-
- /**
- * 扩容
- */
- private void expansion() {
- if (elementData.length <= size)
- elementData = Arrays.copyOf(elementData, elementData.length * 3 / 2 + 1);
- }
-
- /**
- * 越界
- */
- private void outOfBoundsForAdd(int index) {
- if (index > size || index < 0)
- throw new IndexOutOfBoundsException("数组下标越界");
- }
-
- private void outOfBoundsForOther(int index) {
- if (index >= size || index < 0)
- throw new IndexOutOfBoundsException("数组下标越界");
- }
-
- public void add(Object o) {
- expansion();
- elementData[size++] = o;
- }
-
- public void add(int index, Object o) {
- outOfBoundsForAdd(index);
- expansion();
- for (int i = size - 1; i >= index; i--) {
- elementData[i + 1] = elementData[i];
- }
- elementData[index] = o;
- size++;
- }
-
- public Object get(int index) {
- outOfBoundsForOther(index);
- return elementData[index];
- }
-
- public Object remove(int index) {
- outOfBoundsForOther(index);
- Object re = elementData[index];
- for (int i = index; i < size - 1; i++) {
- elementData[i] = elementData[i + 1];
- }
- elementData[size - 1] = null;
- size--;
- return re;
- }
-
- public int size() {
- return size;
- }
-
- @Override
- public String toString() {
- return Arrays.toString(elementData);
- }
-
- public Iterator iterator() {
- return new ArrayIterator();
- }
-
- private class ArrayIterator implements Iterator {
-
- int pos = -1;
-
- @Override
- public boolean hasNext() {
- return size > ++pos ? true : false;
- }
-
- @Override
- public Object next() {
- return elementData[pos];
- }
-
- }
-
-}
diff --git a/group01/932573198/20170220/src/com/coding/basic/BinaryTree.java b/group01/932573198/20170220/src/com/coding/basic/BinaryTree.java
deleted file mode 100644
index 730d7e7b3a..0000000000
--- a/group01/932573198/20170220/src/com/coding/basic/BinaryTree.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.coding.basic;
-
-public class BinaryTree {
-
- private BinaryTreeNode tNode;
-
- @Override
- public String toString() {
- return tNode + "";
- }
-
- public void insert(Object o) {
- tNode = insert(o, tNode);
- }
-
- public BinaryTreeNode insert(Object o, BinaryTreeNode node) {
- if (node == null) {
- node = new BinaryTreeNode(o);
- } else {
- int result = o.toString().compareTo(node.getData().toString());
- if (result < 0)
- node.setLeft(insert(o, node.getLeft()));
- if (result > 0)
- node.setRight(insert(o, node.getRight()));
- }
- return node;
- }
-
- private static class BinaryTreeNode {
-
- private BinaryTreeNode left;
-
- private Object data;
-
- private BinaryTreeNode right;
-
- public BinaryTreeNode() {
- }
-
- public BinaryTreeNode(Object data) {
- this.left = null;
- this.data = data;
- this.right = null;
- }
-
- public BinaryTreeNode getLeft() {
- return left;
- }
-
- public void setLeft(BinaryTreeNode left) {
- this.left = left;
- }
-
- public Object getData() {
- return data;
- }
-
- public void setData(Object data) {
- this.data = data;
- }
-
- public BinaryTreeNode getRight() {
- return right;
- }
-
- public void setRight(BinaryTreeNode right) {
- this.right = right;
- }
-
- @Override
- public String toString() {
- return "[" + left + ", " + data + ", " + right + "]";
- }
-
- }
-
-}
diff --git a/group01/932573198/20170220/src/com/coding/basic/Iterator.java b/group01/932573198/20170220/src/com/coding/basic/Iterator.java
deleted file mode 100644
index ff93e30377..0000000000
--- a/group01/932573198/20170220/src/com/coding/basic/Iterator.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.coding.basic;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-}
diff --git a/group01/932573198/20170220/src/com/coding/basic/LinkedList.java b/group01/932573198/20170220/src/com/coding/basic/LinkedList.java
deleted file mode 100644
index db61384e4c..0000000000
--- a/group01/932573198/20170220/src/com/coding/basic/LinkedList.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package com.coding.basic;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-
- private int size = 0;
-
- private Node head;
-
-
- public Node getHead() {
- return head;
- }
-
- public LinkedList() {
- this.head = new Node();
- }
-
- @Override
- public String toString() {
- return "[" + head + "]";
- }
-
- private void outOfBoundsForAdd(int index) {
- if (index > size || index < 0)
- throw new IndexOutOfBoundsException("数组下标越界");
- }
-
- private void outOfBoundsForOther(int index) {
- if (index >= size || index < 0)
- throw new IndexOutOfBoundsException("数组下标越界");
- }
-
- public void add(Object o) {
- Node node = head;
- while (node.next != null) {
- node = node.next;
- }
- node.next = new Node(o);
- size++;
- }
-
- public void add(int index, Object o) {
- outOfBoundsForAdd(index);
- if(size == index)
- add(o);
- else{
- Node prevNode = head;
- for (int i = 0; i < index; i++) {
- prevNode = prevNode.next;
- }
- Node nextNode = prevNode.next;
- Node node = new Node(o);
- prevNode.next = node;
- node.next = nextNode;
- size++;
- }
- }
-
- public Object get(int index) {
- outOfBoundsForOther(index);
- Node node = head;
- for (int i = 0; i <= index; i++) {
- node = node.next;
- }
- return node.data;
- }
-
- public Object remove(int index) {
- outOfBoundsForOther(index);
- Node prevNode = head;
- for (int i = 0; i < index; i++) {
- prevNode = prevNode.next;
- }
- Node node = prevNode.next;
- prevNode.next = node.next;
- size--;
- return node.data;
- }
-
- public int size() {
- return size;
- }
-
- public void addFirst(Object o) {
- Node newNode = new Node(o);
- Node node = head.next;
- head.next = newNode;
- newNode.next = node;
- size++;
- }
-
- public void addLast(Object o) {
- Node node = head;
- while (node.next != null) {
- node = node.next;
- }
- node.next = new Node(o);
- size++;
- }
-
- private void noSuchEle() {
- if (head.next == null)
- throw new NoSuchElementException("没有这个元素");
- }
-
- public Object removeFirst() {
- noSuchEle();
- Node node = head.next;
- head.next = node.next;
- size--;
- return node.data;
- }
-
- public Object removeLast() {
- noSuchEle();
- Node node = head;
- for(int i=0;i
-
- 4.0.0
-
- com.aaront.execrise
- coding2017
- 1.0.0-SNAPSHOT
- jar
-
-
-
- UTF-8
- 1.8
-
-
-
-
- junit
- junit
- 4.12
-
-
-
\ No newline at end of file
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/ArrayList.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/ArrayList.java
deleted file mode 100644
index ae462ea905..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/ArrayList.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.aaront.exercise.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private static final double factor = 0.75;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o) {
- _ensureCapacityEnough();
- elementData[size++] = o;
- }
-
- public void add(int index, Object o) {
- if (index < 0 || index > size) throw new IndexOutOfBoundsException("index超出边界");
- _ensureCapacityEnough();
- int i = size;
- for (; i > index; i--) {
- elementData[i] = elementData[i - 1];
- }
- elementData[i] = o;
- size++;
- }
-
- private void _ensureCapacityEnough() {
- if (size >= elementData.length) {
- dilatancy();
- }
- }
-
- private void dilatancy() {
- int newLength = elementData.length + (int) (elementData.length * factor);
- elementData = Arrays.copyOf(elementData, newLength);
- }
-
- public Object get(int index) {
- if(index < 0 || index >= size) throw new IndexOutOfBoundsException("index超出边界");
- return elementData[index];
- }
-
- public Object remove(int index) {
- if (index < 0 || index >= size) throw new IndexOutOfBoundsException("index超出边界");
- Object element = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size - 1 - index);
- size--;
- return element;
-
- }
-
- public int size() {
- return size;
- }
-
- public Iterator iterator() {
- return new ArrayListIterator(this);
- }
-
- public Object[] toArray() {
- Object[] objects = new Object[size];
- System.arraycopy(elementData, 0, objects, 0, size);
- return objects;
- }
-
- private static class ArrayListIterator implements Iterator {
-
- private ArrayList arrayList;
- private int pos = 0;
-
- private ArrayListIterator(ArrayList arrayList) {
- this.arrayList = arrayList;
- }
-
- public boolean hasNext() {
- return pos < arrayList.size();
- }
-
- public Object next() {
- return arrayList.elementData[pos++];
- }
-
- public void remove() {
- arrayList.remove(pos - 1);
- pos--;
- }
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/BinaryTree.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/BinaryTree.java
deleted file mode 100644
index 2c0d156561..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/BinaryTree.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package com.aaront.exercise.basic;
-
-public class BinaryTree {
-
- private BinaryTreeNode head = new BinaryTreeNode(null);
- private BinaryTreeNode root;
- private int size;
- private int index = 0;
-
- public static final int PREORDER = 0;
- public static final int INORDER = 1;
- public static final int POSTORDER = 2;
- public static final int HIERARCHICAL = 3;
-
- public static final int RECURSION = 10;
- public static final int ITERATION = 11;
-
- public void add(Integer o) {
- BinaryTreeNode node = new BinaryTreeNode(o);
- if (root == null) {
- root = node;
- head.setLeft(root);
- } else {
- insert(root, node);
- }
- size++;
- }
-
- private void insert(BinaryTreeNode node, BinaryTreeNode newNode) {
- // 要插入的节点插入当前节点的左子树
- if (node.getData() > newNode.getData()) {
- if (node.getLeft() == null) {
- node.setLeft(newNode);
- } else {
- insert(node.left, newNode);
- }
- } else { // 要插入的节点插入当前节点的右子树
- if (node.getRight() == null) {
- node.setRight(newNode);
- } else {
- insert(node.right, newNode);
- }
- }
- }
-
- public BinaryTreeNode search(int data) {
- return search(data, ITERATION);
- }
-
- public BinaryTreeNode search(int data, int method) {
- switch (method) {
- case RECURSION:
- return findNodeRecursion(root, data);
- case ITERATION:
- return findNodeIteration(data);
- default:
- throw new IllegalArgumentException("不支持的查找方法");
- }
- }
-
- private BinaryTreeNode findNodeRecursion(BinaryTreeNode node, int data) {
- if (node == null) return null;
- if (node.getData() == data) return node;
- if (node.getData() > data) return findNodeRecursion(node.getLeft(), data);
- return findNodeRecursion(node.getRight(), data);
- }
-
- private BinaryTreeNode findNodeIteration(int data) {
- BinaryTreeNode currentNode = root;
- while (currentNode != null) {
- if (currentNode.getData() == data) {
- return currentNode;
- }
- if (currentNode.getData() > data) {
- currentNode = currentNode.getLeft();
- } else {
- currentNode = currentNode.getRight();
- }
- }
- return null;
- }
-
- public BinaryTreeNode min() {
- return findMin(root);
- }
-
- private BinaryTreeNode findMin(BinaryTreeNode node) {
- if (node == null) return null;
- if (node.getLeft() == null) return node;
- return findMin(node.getLeft());
- }
-
- public BinaryTreeNode max() {
- return findMax(root);
- }
-
- private BinaryTreeNode findMax(BinaryTreeNode node) {
- if (node == null) return null;
- if (node.getRight() == null) return node;
- return findMax(node.getRight());
- }
-
- public void delete(Integer data) {
- BinaryTreeNode node = search(data);
- if (node == null) return;
- BinaryTreeNode parentNode = searchParentNode(node);
- if (parentNode == null) return;
- // 删除叶子节点
- if (node.getLeft() == null && node.getRight() == null) {
- if (parentNode.getLeft() == node) parentNode.setLeft(null);
- else parentNode.setRight(null);
- } else if (node.getLeft() != null && node.getRight() == null) { // 删除只有左子树的节点
- if (parentNode.getLeft() == node) parentNode.setLeft(node.getLeft());
- else parentNode.setRight(node.getLeft());
- } else if (node.getRight() != null && node.getLeft() == null) { // 删除只有右子树的节点
- if (parentNode.getLeft() == node) parentNode.setLeft(node.getRight());
- else parentNode.setRight(node.getRight());
- } else { // 删除有两个子树的节点
- BinaryTreeNode replace = findMin(node.getRight());
- BinaryTreeNode replaceParentNode = searchParentNode(replace);
- replaceParentNode.setLeft(replace.getRight());
- node.setData(replace.getData());
- replace.setLeft(null);
- replace.setRight(null);
- }
- size--;
- }
-
- private BinaryTreeNode searchParentNode(BinaryTreeNode node) {
- if (node == null) return null;
- if (node == root) return head;
- BinaryTreeNode current = root;
- while (current != null) {
- if (current.getLeft() == node || current.getRight() == node) return current;
- if (current.getData().compareTo(node.getData()) > 0) current = current.getLeft();
- else current = current.getRight();
- }
- return null;
- }
-
- public int[] traversal() {
- return traversal(PREORDER);
- }
-
- public int[] traversal(int order) {
- int[] datas = new int[size];
- if (order == PREORDER) {
- preorderTraversal(root, datas);
- } else if (order == INORDER) {
- inorderTraversal(root, datas);
- } else if (order == POSTORDER) {
- postorderTraversal(root, datas);
- } else {
- hierarchicalTraversal(root, datas);
- }
- index = 0;
- return datas;
- }
-
- private void preorderTraversal(BinaryTreeNode node, int[] datas) {
- if (node == null) {
- return;
- }
-
- datas[index++] = node.getData();
- preorderTraversal(node.getLeft(), datas);
- preorderTraversal(node.getRight(), datas);
- }
-
- private void inorderTraversal(BinaryTreeNode node, int[] datas) {
- if (node == null) {
- return;
- }
-
- inorderTraversal(node.getLeft(), datas);
- datas[index++] = node.getData();
- inorderTraversal(node.getRight(), datas);
- }
-
- private void postorderTraversal(BinaryTreeNode node, int[] datas) {
- if (node == null) {
- return;
- }
-
- postorderTraversal(node.getLeft(), datas);
- postorderTraversal(node.getRight(), datas);
- datas[index++] = node.getData();
- }
-
- private void hierarchicalTraversal(BinaryTreeNode node, int[] datas) {
- if (node == null) return;
- Queue queue = new Queue();
- queue.enQueue(node);
- while (!queue.isEmpty()) {
- BinaryTreeNode tmp = (BinaryTreeNode) queue.deQueue();
- datas[index++] = tmp.getData();
- if (tmp.getLeft() != null) queue.enQueue(tmp.getLeft());
- if (tmp.getRight() != null) queue.enQueue(tmp.getRight());
- }
- }
-
- public class BinaryTreeNode {
- private Integer data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(Integer data) {
- this.data = data;
- }
-
- public Integer getData() {
- return data;
- }
-
- public void setData(Integer 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;
- }
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Iterator.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Iterator.java
deleted file mode 100644
index e446dd8f65..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Iterator.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.aaront.exercise.basic;
-
-public interface Iterator {
- boolean hasNext();
-
- Object next();
-
- void remove();
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/LinkedList.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/LinkedList.java
deleted file mode 100644
index 504e73580b..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/LinkedList.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.aaront.exercise.basic;
-
-public class LinkedList implements List {
-
- private Node head = new Node(null);
- private int size = 0;
-
- public void add(Object o) {
- Node newNode = new Node(o);
- Node first = head.next;
- Node second = head;
- while (first != null) {
- second = first;
- first = first.next;
- }
- second.next = newNode;
- size++;
- }
-
- public void add(int index, Object o) {
- if (index < 0 || index > size) throw new IndexOutOfBoundsException("索引超出范围");
- Node first = head;
- int i = 0;
- while (i < index) {
- first = first.next;
- i++;
- }
- Node node = new Node(o);
- node.next = first.next;
- first.next = node;
- size++;
- }
-
- public Object get(int index) {
- if (index < 0 || index >= size) throw new IndexOutOfBoundsException("索引超出范围");
- Node first = head.next;
- int i = 0;
- while (i < index) {
- first = first.next;
- i++;
- }
- return first.data;
- }
-
- public Object remove(int index) {
- if (index < 0 || index >= size) throw new IndexOutOfBoundsException("索引超出范围");
- Node first = head;
- int i = 0;
- while (i < index) {
- first = first.next;
- i++;
- }
- Node element = first.next;
- first.next = first.next.next;
- size--;
- return element.data;
- }
-
- public int size() {
- return size;
- }
-
- public void addFirst(Object o) {
- add(0, o);
- }
-
- public void addLast(Object o) {
- add(size, o);
- }
-
- public Object removeFirst() {
- return remove(0);
- }
-
- public Object removeLast() {
- return remove(size - 1);
- }
-
- public Iterator iterator() {
- return new LinkedListIterator(this);
- }
-
- public Object[] toArray() {
- Object[] objects = new Object[size];
- Node first = head.next;
- int pos = 0;
- while (first!= null) {
- objects[pos++] = first.data;
- first = first.next;
- }
- return objects;
- }
-
- private static class LinkedListIterator implements Iterator {
-
- private int pos = 0;
- private LinkedList linkedList;
-
- private LinkedListIterator(LinkedList linkList) {
- this.linkedList = linkList;
- }
-
- @Override
- public boolean hasNext() {
- return pos < linkedList.size();
- }
-
- @Override
- public Object next() {
- return linkedList.get(pos++);
- }
-
- @Override
- public void remove() {
- linkedList.remove(pos - 1);
- pos--;
- }
- }
-
-
- private static class Node {
- private Object data;
- private Node next;
-
- private Node(Object data) {
- this.data = data;
- }
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/List.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/List.java
deleted file mode 100644
index 0988b60f4a..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.aaront.exercise.basic;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Queue.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Queue.java
deleted file mode 100644
index 7c310bca9e..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Queue.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.aaront.exercise.basic;
-
-public class Queue {
-
- private LinkedList linkedList = new LinkedList();
-
- public void enQueue(Object o) {
- linkedList.add(o);
- }
-
- public Object deQueue() {
- return linkedList.removeFirst();
- }
-
- public boolean isEmpty() {
- return linkedList.size() == 0;
- }
-
- public int size() {
- return linkedList.size();
- }
-
- public Object[] toArray() {
- return linkedList.toArray();
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Stack.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Stack.java
deleted file mode 100644
index 450d21ee89..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/basic/Stack.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.aaront.exercise.basic;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o) {
- elementData.add(o);
- }
-
- public Object pop() {
- return elementData.remove(elementData.size() - 1);
- }
-
- public Object peek() {
- return elementData.get(elementData.size() - 1);
- }
-
- public boolean isEmpty() {
- return elementData.size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-
- public Object[] toArray() {
- return elementData.toArray();
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericArrayList.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericArrayList.java
deleted file mode 100644
index a099746b55..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericArrayList.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.aaront.exercise.generic;
-
-import java.util.Arrays;
-
-public class GenericArrayList implements GenericList {
-
- private int size = 0;
-
- private static final double factor = 0.75;
-
- private Object[] elementData = new Object[100];
-
- public void add(T o) {
- _ensureCapacityEnough();
- elementData[size++] = o;
- }
-
- public void add(int index, T o) {
- if (index < 0 || index > size) throw new IndexOutOfBoundsException("index超出边界");
- _ensureCapacityEnough();
- int i = size;
- for (; i > index; i--) {
- elementData[i] = elementData[i - 1];
- }
- elementData[i] = o;
- size++;
- }
-
- private void _ensureCapacityEnough() {
- if (size >= elementData.length) {
- dilatancy();
- }
- }
-
- private void dilatancy() {
- int newLength = elementData.length + (int) (elementData.length * factor);
- elementData = Arrays.copyOf(elementData, newLength);
- }
-
- public T get(int index) {
- if(index < 0 || index >= size) throw new IndexOutOfBoundsException("index超出边界");
- return (T) elementData[index];
- }
-
- public T remove(int index) {
- if (index < 0 || index >= size) throw new IndexOutOfBoundsException("index超出边界");
- Object element = elementData[index];
- System.arraycopy(elementData, index + 1, elementData, index, size - 1 - index);
- size--;
- return (T) element;
-
- }
-
- public int size() {
- return size;
- }
-
- public GenericIterator iterator() {
- return new ArrayListGenericIterator(this);
- }
-
- public Object[] toArray() {
- Object[] objects = new Object[size];
- System.arraycopy(elementData, 0, objects, 0, size);
- return objects;
- }
-
- public T[] toArray(T[] a) {
- if (a.length < size)
- // Make a new array of a's runtime type, but my contents:
- return (T[]) Arrays.copyOf(elementData, size, a.getClass());
- System.arraycopy(elementData, 0, a, 0, size);
- return a;
- }
-
- private static class ArrayListGenericIterator implements GenericIterator {
-
- private GenericArrayList genericArrayList;
- private int pos = 0;
-
- private ArrayListGenericIterator(GenericArrayList genericArrayList) {
- this.genericArrayList = genericArrayList;
- }
-
- public boolean hasNext() {
- return pos < genericArrayList.size();
- }
-
- public T next() {
- return (T) genericArrayList.elementData[pos++];
- }
-
- public void remove() {
- genericArrayList.remove(pos - 1);
- pos--;
- }
- }
-}
\ No newline at end of file
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericBinaryTree.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericBinaryTree.java
deleted file mode 100644
index e5cf3b439a..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericBinaryTree.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package com.aaront.exercise.generic;
-
-import java.util.Arrays;
-
-public class GenericBinaryTree> {
-
- private BinaryTreeNode head = new BinaryTreeNode<>(null);
- private BinaryTreeNode root;
- private int size;
- private int index = 0;
- public static final int PREORDER = 0;
- public static final int INORDER = 1;
- public static final int POSTORDER = 2;
- public static final int HIERARCHICAL = 3;
-
- public static final int RECURSION = 10;
- public static final int ITERATION = 11;
-
- public void add(T o) {
- BinaryTreeNode node = new BinaryTreeNode<>(o);
- if (root == null) {
- root = node;
- head.setLeft(root);
- } else {
- insert(root, node);
- }
- size++;
- }
-
- private void insert(BinaryTreeNode node, BinaryTreeNode newNode) {
- // 要插入的节点插入当前节点的左子树
- if (node.getData().compareTo(newNode.getData()) > 0) {
- if (node.getLeft() == null) {
- node.setLeft(newNode);
- } else {
- insert(node.left, newNode);
- }
- } else { // 要插入的节点插入当前节点的右子树
- if (node.getRight() == null) {
- node.setRight(newNode);
- } else {
- insert(node.right, newNode);
- }
- }
- }
-
- public BinaryTreeNode search(T data) {
- return search(data, ITERATION);
- }
-
- public BinaryTreeNode search(T data, int method) {
- switch (method) {
- case RECURSION:
- return findNodeRecursion(root, data);
- case ITERATION:
- return findNodeIteration(data);
- default:
- throw new IllegalArgumentException("不支持的查找方法");
- }
- }
-
- private BinaryTreeNode findNodeRecursion(BinaryTreeNode node, T data) {
- if (node == null) return null;
- if (node.getData().compareTo(data) == 0) return node;
- if (node.getData().compareTo(data) > 0) return findNodeRecursion(node.getLeft(), data);
- return findNodeRecursion(node.getRight(), data);
- }
-
- private BinaryTreeNode findNodeIteration(T data) {
- BinaryTreeNode currentNode = root;
- while (currentNode != null) {
- if (currentNode.getData().compareTo(data) == 0) {
- return currentNode;
- }
- if (currentNode.getData().compareTo(data) > 0) {
- currentNode = currentNode.getLeft();
- } else {
- currentNode = currentNode.getRight();
- }
- }
- return null;
- }
-
- public BinaryTreeNode min() {
- return findMin(root);
- }
-
- private BinaryTreeNode findMin(BinaryTreeNode node) {
- if (node == null) return null;
- if (node.getLeft() == null) return node;
- return findMin(node.getLeft());
- }
-
- public BinaryTreeNode max() {
- return findMax(root);
- }
-
- private BinaryTreeNode findMax(BinaryTreeNode node) {
- if (node == null) return null;
- if (node.getRight() == null) return node;
- return findMax(node.getRight());
- }
-
- public void delete(T data) {
- BinaryTreeNode node = search(data);
- if (node == null) return;
- BinaryTreeNode parentNode = searchParentNode(node);
- if (parentNode == null) return;
- // 删除叶子节点
- if (node.getLeft() == null && node.getRight() == null) {
- if (parentNode.getLeft() == node) parentNode.setLeft(null);
- else parentNode.setRight(null);
- } else if (node.getLeft() != null && node.getRight() == null) { // 删除只有左子树的节点
- if (parentNode.getLeft() == node) parentNode.setLeft(node.getLeft());
- else parentNode.setRight(node.getLeft());
- } else if (node.getRight() != null && node.getLeft() == null) { // 删除只有右子树的节点
- if (parentNode.getLeft() == node) parentNode.setLeft(node.getRight());
- else parentNode.setRight(node.getRight());
- } else { // 删除有两个子树的节点
- BinaryTreeNode replace = findMin(node.getRight());
- BinaryTreeNode replaceParentNode = searchParentNode(replace);
- replaceParentNode.setLeft(replace.getRight());
- node.setData(replace.getData());
- replace.setLeft(null);
- replace.setRight(null);
- }
- size--;
- }
-
- private BinaryTreeNode searchParentNode(BinaryTreeNode node) {
- if (node == null) return null;
- if (node == root) return head;
- BinaryTreeNode current = root;
- while (current != null) {
- if (current.getLeft() == node || current.getRight() == node) return current;
- if (current.getData().compareTo(node.getData()) > 0) current = current.getLeft();
- else current = current.getRight();
- }
- return null;
- }
-
- public Object[] traversal() {
- return traversal(PREORDER);
- }
-
- public T[] traversal(T[] a) {
- Object[] elementData = traversal(PREORDER);
- return toArray(elementData, a);
- }
-
- public T[] traversal(int order, T[] a) {
- Object[] elementData = traversal(order);
- return toArray(elementData, a);
- }
-
- private T[] toArray(Object[] elementData, T[] a) {
- if (a.length < size)
- // Make a new array of a's runtime type, but my contents:
- return (T[]) Arrays.copyOf(elementData, size, a.getClass());
- System.arraycopy(elementData, 0, a, 0, size);
- return a;
- }
-
- public Object[] traversal(int order) {
- Object[] datas = new Object[size];
- if (order == PREORDER) {
- preorderTraversal(root, datas);
- } else if (order == INORDER) {
- inorderTraversal(root, datas);
- } else if (order == POSTORDER) {
- postorderTraversal(root, datas);
- } else {
- hierarchicalTraversal(root, datas);
- }
- index = 0;
- return datas;
- }
-
- private void preorderTraversal(BinaryTreeNode node, Object[] datas) {
- if (node == null) {
- return;
- }
-
- datas[index++] = node.getData();
- preorderTraversal(node.getLeft(), datas);
- preorderTraversal(node.getRight(), datas);
- }
-
- private void inorderTraversal(BinaryTreeNode node, Object[] datas) {
- if (node == null) {
- return;
- }
-
- inorderTraversal(node.getLeft(), datas);
- datas[index++] = node.getData();
- inorderTraversal(node.getRight(), datas);
- }
-
- private void postorderTraversal(BinaryTreeNode node, Object[] datas) {
- if (node == null) {
- return;
- }
-
- postorderTraversal(node.getLeft(), datas);
- postorderTraversal(node.getRight(), datas);
- datas[index++] = node.getData();
- }
-
- private void hierarchicalTraversal(BinaryTreeNode node, Object[] datas) {
- if (node == null) return;
- GenericQueue> queue = new GenericQueue<>();
- queue.enQueue(node);
- while (!queue.isEmpty()) {
- BinaryTreeNode tmp = queue.deQueue();
- datas[index++] = tmp.getData();
- if (tmp.getLeft() != null) queue.enQueue(tmp.getLeft());
- if (tmp.getRight() != null) queue.enQueue(tmp.getRight());
- }
- }
-
-
- class BinaryTreeNode> {
- private T data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- public BinaryTreeNode(T data) {
- this.data = data;
- }
-
- public T getData() {
- return data;
- }
-
- public void setData(T 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;
- }
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericIterator.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericIterator.java
deleted file mode 100644
index 565114dce7..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericIterator.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.aaront.exercise.generic;
-
-public interface GenericIterator {
- boolean hasNext();
-
- T next();
-
- void remove();
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericLinkedList.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericLinkedList.java
deleted file mode 100644
index 7caf32eae1..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericLinkedList.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.aaront.exercise.generic;
-
-import java.util.Arrays;
-
-public class GenericLinkedList implements GenericList {
-
- private Node head = new Node<>(null);
- private int size = 0;
-
- public void add(T o) {
- Node newNode = new Node<>(o);
- Node first = head.next;
- Node second = head;
- while (first != null) {
- second = first;
- first = first.next;
- }
- second.next = newNode;
- size++;
- }
-
- public void add(int index, T o) {
- if (index < 0 || index > size) throw new IndexOutOfBoundsException("索引超出范围");
- Node first = head;
- int i = 0;
- while (i < index) {
- first = first.next;
- i++;
- }
- Node node = new Node<>(o);
- node.next = first.next;
- first.next = node;
- size++;
- }
-
- public T get(int index) {
- if (index < 0 || index >= size) throw new IndexOutOfBoundsException("索引超出范围");
- Node first = head.next;
- int i = 0;
- while (i < index) {
- first = first.next;
- i++;
- }
- return first.data;
- }
-
- public T remove(int index) {
- if (index < 0 || index >= size) throw new IndexOutOfBoundsException("索引超出范围");
- Node first = head;
- int i = 0;
- while (i < index) {
- first = first.next;
- i++;
- }
- Node element = first.next;
- first.next = first.next.next;
- size--;
- return element.data;
- }
-
- public int size() {
- return size;
- }
-
- public void addFirst(T o) {
- add(0, o);
- }
-
- public void addLast(T o) {
- add(size, o);
- }
-
- public T removeFirst() {
- return remove(0);
- }
-
- public T removeLast() {
- return remove(size - 1);
- }
-
- public GenericIterator iterator() {
- return new LinkedListGenericIterator<>(this);
- }
-
- public Object[] toArray() {
- Object[] objects = new Object[size];
- Node first = head.next;
- int pos = 0;
- while (first != null) {
- objects[pos++] = first.data;
- first = first.next;
- }
- return objects;
- }
-
- public T[] toArray(T[] a) {
- Object[] elementData = toArray();
- if (a.length < size)
- // Make a new array of a's runtime type, but my contents:
- return (T[]) Arrays.copyOf(elementData, size, a.getClass());
- System.arraycopy(elementData, 0, a, 0, size);
- return a;
- }
-
- private static class LinkedListGenericIterator implements GenericIterator {
-
- private int pos = 0;
- private GenericLinkedList genericLinkedList;
-
- private LinkedListGenericIterator(GenericLinkedList linkList) {
- this.genericLinkedList = linkList;
- }
-
- @Override
- public boolean hasNext() {
- return pos < genericLinkedList.size();
- }
-
- @Override
- public T next() {
- return genericLinkedList.get(pos++);
- }
-
- @Override
- public void remove() {
- genericLinkedList.remove(pos - 1);
- pos--;
- }
- }
-
-
- private static class Node {
- private T data;
- private Node next;
-
- private Node(T data) {
- this.data = data;
- }
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericList.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericList.java
deleted file mode 100644
index 94dc9f8a98..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericList.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.aaront.exercise.generic;
-
-public interface GenericList {
- public void add(T o);
- public void add(int index, T o);
- public T get(int index);
- public T remove(int index);
- public int size();
-}
\ No newline at end of file
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericQueue.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericQueue.java
deleted file mode 100644
index d5cf5681e5..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericQueue.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.aaront.exercise.generic;
-
-public class GenericQueue {
-
- private GenericLinkedList linkedList = new GenericLinkedList<>();
-
- public void enQueue(T o) {
- linkedList.add(o);
- }
-
- public T deQueue() {
- return linkedList.removeFirst();
- }
-
- public boolean isEmpty() {
- return linkedList.size() == 0;
- }
-
- public int size() {
- return linkedList.size();
- }
-
- public Object[] toArray() {
- return linkedList.toArray();
- }
-
- public T[] toArray(T[] a) {
- return linkedList.toArray(a);
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericStack.java b/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericStack.java
deleted file mode 100644
index 9efb2f2220..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/main/java/com/aaront/exercise/generic/GenericStack.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.aaront.exercise.generic;
-
-public class GenericStack {
- private GenericArrayList elementData = new GenericArrayList<>();
-
- public void push(T o) {
- elementData.add(o);
- }
-
- public T pop() {
- return elementData.remove(elementData.size() - 1);
- }
-
- public T peek() {
- return elementData.get(elementData.size() - 1);
- }
-
- public boolean isEmpty() {
- return elementData.size() == 0;
- }
-
- public int size() {
- return elementData.size();
- }
-
- public Object[] toArray() {
- return elementData.toArray();
- }
-
- public T[] toArray(T[] a) {
- return elementData.toArray(a);
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/AllTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/AllTest.java
deleted file mode 100644
index ebff633b23..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/AllTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.aaront.execrise.basic;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * @author tonyhui
- * @since 17/2/21
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ArrayListTest.class,
- BinaryTreeTest.class,
- LinkListTest.class,
- QueueTest.class,
- StackTest.class
-})
-public class AllTest {
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/ArrayListTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/ArrayListTest.java
deleted file mode 100644
index dcc45d792e..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/ArrayListTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.aaront.execrise.basic;
-
-import com.aaront.exercise.basic.ArrayList;
-import com.aaront.exercise.basic.Iterator;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/20
- */
-public class ArrayListTest {
-
- private ArrayList arrayList = new ArrayList();
-
- @Before
- public void init() {
- arrayList.add(1);
- arrayList.add(2);
- arrayList.add(3);
- }
-
- @Test
- public void testAdd() {
- Assert.assertEquals(arrayList.get(0), 1);
- Assert.assertEquals(arrayList.get(1), 2);
- Assert.assertEquals(arrayList.get(2), 3);
- Assert.assertEquals(arrayList.size(), 3);
- }
-
- @Test
- public void testAddIndex() {
- arrayList.add(1, 4);
- arrayList.add(2, 5);
- Assert.assertArrayEquals(arrayList.toArray(), new Object[]{1, 4, 5, 2, 3});
- }
-
- @Test
- public void testToArray() {
- Assert.assertArrayEquals(arrayList.toArray(), new Object[]{1, 2, 3});
- }
-
- @Test
- public void testGet() {
- Assert.assertEquals(arrayList.get(2), 3);
- Assert.assertEquals(arrayList.get(0), 1);
- Assert.assertEquals(arrayList.get(1), 2);
- }
-
- @Test
- public void testRemove() {
- testAddIndex();
- arrayList.remove(2);
- arrayList.add(4, 10);
- arrayList.add(3, 9);
- Assert.assertArrayEquals(arrayList.toArray(), new Object[]{1, 4, 2, 9, 3, 10});
- }
-
- @Test
- public void testIterator() {
- Iterator iterator = arrayList.iterator();
- while (iterator.hasNext()) {
- iterator.next();
- iterator.remove();
- }
- Assert.assertArrayEquals(arrayList.toArray(), new Object[]{});
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/BinaryTreeTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/BinaryTreeTest.java
deleted file mode 100644
index 11fb7ad66b..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/BinaryTreeTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.aaront.execrise.basic;
-
-import com.aaront.exercise.basic.BinaryTree;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/20
- */
-public class BinaryTreeTest {
-
- private BinaryTree binaryTree = null;
-
- @Before
- public void init() {
- int[] datas = new int[]{9, 4, 5, 7, 1, 2, 3, 10, 17, 9};
- binaryTree = new BinaryTree();
- for (int data : datas) {
- binaryTree.add(data);
- }
- }
-
-
- @Test
- public void testAdd() {
- int[] preorderDatas = binaryTree.traversal(BinaryTree.PREORDER);
- Assert.assertArrayEquals(preorderDatas, new int[]{9, 4, 1, 2, 3, 5, 7, 10, 9, 17});
- int[] inorderDatas = binaryTree.traversal(BinaryTree.INORDER);
- Assert.assertArrayEquals(inorderDatas, new int[]{1, 2, 3, 4, 5, 7, 9, 9, 10, 17});
- int[] postorderDatas = binaryTree.traversal(BinaryTree.POSTORDER);
- Assert.assertArrayEquals(postorderDatas, new int[]{3, 2, 1, 7, 5, 4, 9, 17, 10, 9});
- int[] hierarchicalDatas = binaryTree.traversal(BinaryTree.HIERARCHICAL);
- Assert.assertArrayEquals(hierarchicalDatas, new int[]{9, 4, 10, 1, 5, 9, 17, 2, 7, 3});
- }
-
- @Test
- public void testSearch() {
- BinaryTree.BinaryTreeNode node1 = binaryTree.search(5, BinaryTree.RECURSION);
- Assert.assertTrue(node1.getData() == 5);
- BinaryTree.BinaryTreeNode node2 = binaryTree.search(17, BinaryTree.RECURSION);
- Assert.assertTrue(node2.getData() == 17);
- BinaryTree.BinaryTreeNode node3 = binaryTree.search(100, BinaryTree.RECURSION);
- Assert.assertTrue(node3 == null);
- }
-
- @Test
- public void testMin() {
- BinaryTree.BinaryTreeNode min = binaryTree.min();
- Assert.assertTrue(min.getData() == 1);
- }
-
- @Test
- public void testMax() {
- BinaryTree.BinaryTreeNode max = binaryTree.max();
- Assert.assertTrue(max.getData() == 17);
- }
-
- @Test
- public void testDelete() {
- buildTree(new int[]{50, 25, 12, 11, 40, 14, 35, 45, 44, 43, 42, 75, 55, 70, 60, 65, 63, 61, 90, 80, 85, 82, 88});
- // 删除叶子节点
- binaryTree.delete(11);
- int[] preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new int[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 70, 60, 65, 63, 61, 90, 80, 85, 82, 88});
- binaryTree.delete(88);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new int[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 70, 60, 65, 63, 61, 90, 80, 85, 82});
-
- // 删除一个子节点的节点
- binaryTree.delete(70);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new int[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 60, 65, 63, 61, 90, 80, 85, 82});
- binaryTree.delete(80);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new int[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 60, 65, 63, 61, 90, 85, 82});
-
- // 删除两个子节点的节点
- binaryTree.delete(40);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new int[]{50, 25, 12, 14, 42, 35, 45, 44, 43, 75, 55, 60, 65, 63, 61, 90, 85, 82});
- binaryTree.delete(50);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new int[]{55, 25, 12, 14, 42, 35, 45, 44, 43, 75, 60, 65, 63, 61, 90, 85, 82});
- }
-
- private void buildTree(int[] datas) {
- binaryTree = new BinaryTree();
- for (int data : datas) {
- binaryTree.add(data);
- }
- }
-}
\ No newline at end of file
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/LinkListTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/LinkListTest.java
deleted file mode 100644
index b690c69c94..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/LinkListTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.aaront.execrise.basic;
-
-import com.aaront.exercise.basic.Iterator;
-import com.aaront.exercise.basic.LinkedList;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/21
- */
-public class LinkListTest {
-
- private LinkedList linkedList = new LinkedList();
-
- @Before
- public void init() {
- linkedList.add(1);
- linkedList.add(2);
- linkedList.add(3);
- }
-
- @Test
- public void testAdd() {
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{1, 2, 3});
- }
-
- @Test
- public void testAddIndex() {
- linkedList.add(1, 10);
- linkedList.add(0, 8);
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{8, 1, 10, 2, 3});
- }
-
- @Test
- public void testAddFirst() {
- linkedList.addFirst(-1);
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{-1, 1, 2, 3});
- }
-
- @Test
- public void testAddLast() {
- linkedList.addLast(99);
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{1, 2, 3, 99});
- }
-
- @Test
- public void testRemove() {
- testAddIndex();
- linkedList.remove(1);
- linkedList.remove(2);
- linkedList.add(3, 3);
- linkedList.add(1, 2);
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{8, 2, 10, 3, 3});
- }
-
- @Test
- public void testRemoveFirst() {
- linkedList.removeFirst();
- linkedList.removeFirst();
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{3});
- }
-
- @Test
- public void testRemoveLast() {
- linkedList.removeLast();
- linkedList.removeLast();
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{1});
- }
-
- @Test
- public void testIterator() {
- Iterator iterator = linkedList.iterator();
- while (iterator.hasNext()) {
- iterator.next();
- iterator.remove();
- }
- Assert.assertArrayEquals(linkedList.toArray(), new Object[]{});
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/QueueTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/QueueTest.java
deleted file mode 100644
index 0035a353ec..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/QueueTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.aaront.execrise.basic;
-
-import com.aaront.exercise.basic.Queue;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/21
- */
-public class QueueTest {
- private Queue queue = new Queue();
-
- @Before
- public void init() {
- queue.enQueue(1);
- queue.enQueue(2);
- queue.enQueue(3);
- }
-
- @Test
- public void testEnqueue() {
- Assert.assertArrayEquals(queue.toArray(), new Object[]{1, 2, 3});
- }
-
- @Test
- public void testDequeue() {
- queue.deQueue();
- queue.deQueue();
- Assert.assertArrayEquals(queue.toArray(), new Object[]{3});
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/StackTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/StackTest.java
deleted file mode 100644
index 3add6bcfdf..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/basic/StackTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.aaront.execrise.basic;
-
-import com.aaront.exercise.basic.Stack;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/21
- */
-public class StackTest {
-
- private Stack stack = new Stack();
-
- @Before
- public void init() {
- stack.push(1);
- stack.push(2);
- stack.push(3);
- }
-
- @Test
- public void testPush() {
- Assert.assertArrayEquals(stack.toArray(), new Object[]{1, 2, 3});
- }
-
- @Test
- public void testPop() {
- Object element1 = stack.pop();
- Assert.assertEquals(element1, 3);
- Object element2 = stack.pop();
- Assert.assertEquals(element2, 2);
- Assert.assertArrayEquals(stack.toArray(), new Object[]{1});
- }
-
- @Test
- public void testPeek() {
- Object element1 = stack.peek();
- Assert.assertEquals(element1, 3);
- Object element2 = stack.peek();
- Assert.assertEquals(element2, 3);
- Assert.assertArrayEquals(stack.toArray(), new Object[]{1, 2, 3});
- }
-
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericAllTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericAllTest.java
deleted file mode 100644
index 66c071cf5c..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericAllTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.aaront.execrise.generic;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * @author tonyhui
- * @since 17/2/22
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- GenericArrayListTest.class,
- GenericLinkedListTest.class,
- GenericQueueTest.class,
- GenericStackTest.class,
- GenericBinaryTreeTest.class
-})
-public class GenericAllTest {
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericArrayListTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericArrayListTest.java
deleted file mode 100644
index 8f97cbd3ea..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericArrayListTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.aaront.execrise.generic;
-
-import com.aaront.exercise.generic.GenericArrayList;
-import com.aaront.exercise.generic.GenericIterator;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/22
- */
-public class GenericArrayListTest {
-
- private GenericArrayList arrayList = new GenericArrayList<>();
-
- @Before
- public void init() {
- arrayList.add("1");
- arrayList.add("2");
- arrayList.add("3");
- }
-
-
- @Test
- public void testAdd() {
- Assert.assertEquals(arrayList.get(0), "1");
- Assert.assertEquals(arrayList.get(1), "2");
- Assert.assertEquals(arrayList.get(2), "3");
- Assert.assertEquals(arrayList.size(), 3);
- }
-
- @Test
- public void testAddIndex() {
- arrayList.add(1, "4");
- arrayList.add(2, "5");
- Assert.assertArrayEquals(arrayList.toArray(), new String[]{"1", "4", "5", "2", "3"});
- }
-
- @Test
- public void testToArray() {
- Assert.assertArrayEquals(arrayList.toArray(), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testToGenericArray() {
- Assert.assertArrayEquals(arrayList.toArray(new String[0]), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testGet() {
- Assert.assertEquals(arrayList.get(2), "3");
- Assert.assertEquals(arrayList.get(0), "1");
- Assert.assertEquals(arrayList.get(1), "2");
- }
-
- @Test
- public void testRemove() {
- testAddIndex();
- arrayList.remove(2);
- arrayList.add(4, "10");
- arrayList.add(3, "9");
- Assert.assertArrayEquals(arrayList.toArray(), new String[]{"1", "4", "2", "9", "3", "10"});
- }
-
- @Test
- public void testIterator() {
- GenericIterator genericIterator = arrayList.iterator();
- while (genericIterator.hasNext()) {
- genericIterator.next();
- genericIterator.remove();
- }
- Assert.assertArrayEquals(arrayList.toArray(), new String[]{});
- }
-
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericBinaryTreeTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericBinaryTreeTest.java
deleted file mode 100644
index 41adbf6706..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericBinaryTreeTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.aaront.execrise.generic;
-
-import com.aaront.exercise.generic.GenericBinaryTree;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/20
- */
-public class GenericBinaryTreeTest {
-
- @Before
- public void init() {
- String[] datas = new String[]{"9", "4", "5", "7", "1", "2", "3", "10", "17", "9"};
- GenericBinaryTree binaryTree = new GenericBinaryTree<>();
- for (String data : datas) {
- binaryTree.add(data);
- }
- }
-
- @Test
- public void testAdd() {
- String[] datas = new String[]{"9", "4", "5", "7", "1", "2", "3", "10", "17", "9"};
- GenericBinaryTree binaryTree = new GenericBinaryTree<>();
- for (String data : datas) {
- binaryTree.add(data);
- }
- String[] preorderDatas = binaryTree.traversal(GenericBinaryTree.PREORDER, new String[0]);
- Assert.assertArrayEquals(preorderDatas, new String[]{"9", "4", "1", "2", "10", "17", "3", "5", "7", "9" });
- String[] inorderDatas = binaryTree.traversal(GenericBinaryTree.INORDER, new String[0]);
- Assert.assertArrayEquals(inorderDatas, new String[]{"1", "10", "17", "2", "3", "4", "5", "7", "9", "9" });
- String[] postorderDatas = binaryTree.traversal(GenericBinaryTree.POSTORDER, new String[0]);
- Assert.assertArrayEquals(postorderDatas, new String[]{"17", "10", "3", "2", "1", "7", "5", "4", "9", "9" });
- String[] hierarchicalDatas = binaryTree.traversal(GenericBinaryTree.HIERARCHICAL, new String[0]);
- Assert.assertArrayEquals(hierarchicalDatas, new String[]{"9", "4", "9", "1", "5", "2", "7", "10", "3", "17" });
- }
-
- @Test
- public void testDelete() {
- GenericBinaryTree binaryTree = buildTree(new int[]{50, 25, 12, 11, 40, 14, 35, 45, 44, 43, 42, 75, 55, 70, 60, 65, 63, 61, 90, 80, 85, 82, 88});
- // 删除叶子节点
- binaryTree.delete(11);
- Object[] preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new Object[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 70, 60, 65, 63, 61, 90, 80, 85, 82, 88});
- binaryTree.delete(88);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new Object[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 70, 60, 65, 63, 61, 90, 80, 85, 82});
-
- // 删除一个子节点的节点
- binaryTree.delete(70);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new Object[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 60, 65, 63, 61, 90, 80, 85, 82});
- binaryTree.delete(80);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new Object[]{50, 25, 12, 14, 40, 35, 45, 44, 43, 42, 75, 55, 60, 65, 63, 61, 90, 85, 82});
-
- // 删除两个子节点的节点
- binaryTree.delete(40);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new Object[]{50, 25, 12, 14, 42, 35, 45, 44, 43, 75, 55, 60, 65, 63, 61, 90, 85, 82});
- binaryTree.delete(50);
- preOrderDatas = binaryTree.traversal();
- Assert.assertArrayEquals(preOrderDatas, new Object[]{55, 25, 12, 14, 42, 35, 45, 44, 43, 75, 60, 65, 63, 61, 90, 85, 82});
- }
-
- private GenericBinaryTree buildTree(int[] datas) {
- GenericBinaryTree binaryTree = new GenericBinaryTree<>();
- for (int data : datas) {
- binaryTree.add(data);
- }
- return binaryTree;
- }
-}
\ No newline at end of file
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericLinkedListTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericLinkedListTest.java
deleted file mode 100644
index 513119fa6e..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericLinkedListTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.aaront.execrise.generic;
-
-import com.aaront.exercise.generic.GenericLinkedList;
-import com.aaront.exercise.generic.GenericIterator;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/22
- */
-public class GenericLinkedListTest {
- private GenericLinkedList linkedList = new GenericLinkedList<>();
-
- @Before
- public void init() {
- linkedList.add("1");
- linkedList.add("2");
- linkedList.add("3");
- }
-
- @Test
- public void testAdd() {
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testAddIndex() {
- linkedList.add(1, "10");
- linkedList.add(0, "8");
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"8", "1", "10", "2", "3"});
- }
-
- @Test
- public void testAddFirst() {
- linkedList.addFirst("-1");
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"-1", "1", "2", "3"});
- }
-
- @Test
- public void testAddLast() {
- linkedList.addLast("99");
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"1", "2", "3", "99"});
- }
-
- @Test
- public void testRemove() {
- testAddIndex();
- linkedList.remove(1);
- linkedList.remove(2);
- linkedList.add(3, "3");
- linkedList.add(1, "2");
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"8", "2", "10", "3", "3"});
- }
-
- @Test
- public void testRemoveFirst() {
- linkedList.removeFirst();
- linkedList.removeFirst();
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"3"});
- }
-
- @Test
- public void testRemoveLast() {
- linkedList.removeLast();
- linkedList.removeLast();
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"1"});
- }
-
- @Test
- public void testToArray() {
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testToGenericArray() {
- Assert.assertArrayEquals(linkedList.toArray(new String[0]), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testIterator() {
- GenericIterator genericIterator = linkedList.iterator();
- while (genericIterator.hasNext()) {
- genericIterator.next();
- genericIterator.remove();
- }
- Assert.assertArrayEquals(linkedList.toArray(), new String[]{});
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericQueueTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericQueueTest.java
deleted file mode 100644
index 6b33a4b3e0..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericQueueTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.aaront.execrise.generic;
-
-import com.aaront.exercise.generic.GenericQueue;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/21
- */
-public class GenericQueueTest {
- private GenericQueue queue = new GenericQueue<>();
-
- @Before
- public void init() {
- queue.enQueue("1");
- queue.enQueue("2");
- queue.enQueue("3");
- }
-
- @Test
- public void testEnqueue() {
- Assert.assertArrayEquals(queue.toArray(), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testDequeue() {
- queue.deQueue();
- queue.deQueue();
- Assert.assertArrayEquals(queue.toArray(), new String[]{"3"});
- }
-}
diff --git a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericStackTest.java b/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericStackTest.java
deleted file mode 100644
index 0b4b587704..0000000000
--- a/group01/954958168/class01/BasicDataStructure/src/test/java/com/aaront/execrise/generic/GenericStackTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.aaront.execrise.generic;
-
-import com.aaront.exercise.generic.GenericStack;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author tonyhui
- * @since 17/2/21
- */
-public class GenericStackTest {
-
- private GenericStack stack = new GenericStack<>();
-
- @Before
- public void init() {
- stack.push("1");
- stack.push("2");
- stack.push("3");
- }
-
- @Test
- public void testPush() {
- Assert.assertArrayEquals(stack.toArray(), new String[]{"1", "2", "3"});
- }
-
- @Test
- public void testPop() {
- String element1 = stack.pop();
- Assert.assertEquals(element1, "3");
- String element2 = stack.pop();
- Assert.assertEquals(element2, "2");
- Assert.assertArrayEquals(stack.toArray(), new String[]{"1"});
- }
-
- @Test
- public void testPeek() {
- String element1 = stack.peek();
- Assert.assertEquals(element1, "3");
- String element2 = stack.peek();
- Assert.assertEquals(element2, "3");
- Assert.assertArrayEquals(stack.toArray(), new String[]{"1", "2", "3"});
- }
-
-}
diff --git a/group01/group01.md b/group01/group01.md
deleted file mode 100644
index 8b13789179..0000000000
--- a/group01/group01.md
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/ArrayList.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/ArrayList.java
deleted file mode 100644
index 59ca0d34ee..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/ArrayList.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public class ArrayList implements List {
-
- //ؼϴС
- private int size = 0;
-
- //ȸһΪ10
- Object[] elementData = new Object[100];
-
- @Override
- //̬Ԫ
- public void add(Object o) {
- //жǷ
- if(size == elementData.length) {
- Object[] newObjects = new Object[elementData.length * 2];
- System.arraycopy(elementData, 0, newObjects, 0, elementData.length);
- elementData = newObjects;
- }
-
- //ΪӵԪָ±
- elementData[size] = o;
- size++;
- }
-
- @Override
- public void add(int index, Object o) {
- //жǷ
- if(size == elementData.length) {
- Object[] newObjects = elementData;
- this.elementData = new Object[elementData.length * 2];
- for(int j = 0; j < newObjects.length; j++) {
- this.elementData[j] = newObjects[j];
- }
- }
-
- for(int i = size - 1; i >= index; i--) {
- elementData[i+1] = elementData[i];
- }
-
- elementData[index] = o;
- size++;
- }
-
- @Override
- public Object get(int index) {
- return elementData[index];
- }
-
- @Override
- public Object remove(int index) {
- if (index > size) {
- return null;
- };
-
- int moveSize = size - index - 1;
-
- if (moveSize > 0) {
- System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
- }
- elementData[--size] = null;
-
- //for(int i = index; i < elementData.length; i++) {
- // elementData[i] = elementData[i+1];
- //}
-
- return elementData;
- }
-
- @Override
- public int size() {
- return size;
- }
-
- public Iterator iterator(){
- return new ArrayListIterator();
- }
-
- private class ArrayListIterator implements Iterator {
-
- private int currentIndex = 0;
-
- @Override
- public boolean hasNext() {
- if(currentIndex >= size) return false;
- else return true;
- }
-
- @Override
- public Object next() {
- Object o = elementData[currentIndex];
- currentIndex ++;
- return o;
- }
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/BinaryTreeNode.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/BinaryTreeNode.java
deleted file mode 100644
index 354b2ba7a0..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Iterator.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Iterator.java
deleted file mode 100644
index 3cf6540e5e..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public interface Iterator {
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/LinkedList.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/LinkedList.java
deleted file mode 100644
index adf30d89c2..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/LinkedList.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public class LinkedList implements List {
-
- //ʾij
- private int size;
-
- //ͷԪ
- private Node head;
- //βԪ
- private Node tail;
-
- //ʹڲʵÿһڵ㣬ÿڵһָһԪصnextԼdata
- private static class Node {
- public Object data;
- public Node next;
-
- public Node(Object data) {
- this.data = data;
- }
- }
-
- //Ĺ췽
- public LinkedList() {
- }
-
- @Override
- public void add(Object o) {
- add(size, o);
- }
-
- @Override
- public void add(int index, Object o) {
- if(index == 0) {
- addFirst(o);
- } else {
- if(index >= size) {
- addLast(o);
- } else {
- Node node = head;
- for (int i = 1; i < index; i++) {
- head = head.next;
- }
- Node nextNode = node.next;
- Node temp = new Node(o);
- node.next = temp;
- temp.next = nextNode;
- size++;
- }
- }
- }
-
- //ǰ
- public void addFirst(Object o) {
- Node newNode = new Node(o);
- newNode.next = head;
- head = newNode;
- size++;
- if(tail == null) {
- tail = head;
- }
- }
-
- //Ӻ
- public void addLast(Object o) {
- if(tail == null) {
- tail = head = new Node(o);
- } else {
- Node newNode = new Node(o);
- tail.next = newNode;
- tail = tail.next;
- }
- size++;
- }
-
-
- @Override
- public Object get(int index) {
- Node node = head;
- for(int i = 0; i < index; i++) {
- node = node.next;
- }
- return node.data;
- }
-
- @Override
- public Object remove(int index) {
- if(size == 0) {
- throw new java.util.NoSuchElementException();
- }
- if(index == 0) {
- Node node = head;
- Node temp = node.next;
- head = temp;
- size--;
- return node.data;
- } else {
- if(index >= size) {
- throw new java.util.NoSuchElementException();
- } else {
- Node node = head;
- for(int i = 1; i < index; i++) {
- node = node.next;
- }
- Node temp = node.next;
- node.next = temp.next;
- size--;
- return node.data;
- }
- }
-
- }
-
- @Override
- public int size() {
- return size;
- }
-
- public Object removeFirst() {
- //ͨͷָ봴ͷڵ
- Node hNode = head;
- if (hNode == null) {
- throw new java.util.NoSuchElementException();
- }
- Node nNode = hNode.next;
- Object element = hNode.data;
-
- //Ƴ
- hNode.data = null;
- hNode.next = null;
- head = nNode;
- //жǷΪβڵ
- if (nNode == null) {
- tail = null;
- }else {
- nNode = null;
- }
- size --;
- return element;
- }
-
- public Object removeLast() {
- return remove(size - 1);
- }
-
- public Iterator iterator() {
- return new LinkedListIterator();
- }
-
- private class LinkedListIterator implements Iterator {
-
- private Node node = head.next;
-
- @Override
- public boolean hasNext() {
- return node != tail;
- }
-
- @Override
- public Object next() {
-
- if(!hasNext()) {
- throw new java.util.NoSuchElementException();
- }
- Object nextData = node.data;
- node = node.next;
- return nextData;
- }
-
- }
-
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/List.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/List.java
deleted file mode 100644
index 02e4297a33..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/List.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
-
- public Iterator iterator();
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Queue.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Queue.java
deleted file mode 100644
index 112299b5e9..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Queue.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public class Queue {
-
- private LinkedList list = new LinkedList();
- private int size = 0;
-
- public void enQueue(Object o){
- size++;
- list.addLast(o);
- }
-
- public Object deQueue(){
- size--;
- return list.removeFirst();
- }
-
- public boolean isEmpty(){
- if(size == 0) {
- return true;
- } else {
- return false;
- }
- }
-
- public int size(){
- return size;
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Stack.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Stack.java
deleted file mode 100644
index c0a2658bb3..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/Stack.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.github.Ven13.coding2017.basic;
-
-public class Stack {
- private ArrayList elementData = new ArrayList();
-
- public void push(Object o){
-
- elementData.add(o);
- }
-
- public Object pop(){
- Object o = null;
- if(elementData.size() > 0) {
- o = elementData.get(elementData.size() - 1);
- elementData.remove(elementData.size() - 1);
- }
- return o;
- }
-
- public Object peek(){
- return elementData.get(0);
- }
- public boolean isEmpty(){
- return elementData.size() == 0;
- }
- public int size(){
- return elementData.size();
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/ArrayListTest.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/ArrayListTest.java
deleted file mode 100644
index 7f3f179f3b..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/ArrayListTest.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.Ven13.coding2017.basic.test;
-
-import org.junit.Before;
-
-import com.github.Ven13.coding2017.basic.*;
-
-public class ArrayListTest extends ListTest{
-
-
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/LinkedListTest.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/LinkedListTest.java
deleted file mode 100644
index c6bc65698c..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/LinkedListTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.github.Ven13.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.github.Ven13.coding2017.basic.ArrayList;
-import com.github.Ven13.coding2017.basic.LinkedList;
-import com.github.Ven13.coding2017.basic.List;
-
-public class LinkedListTest extends ListTest {
-
-private LinkedList aLinkedList;
-
- @Before
- public void setUpLinkedList() {
- List aList = new ArrayList();
- aList = new LinkedList();
- aLinkedList = new LinkedList();
- }
-
- @Test
- public void testAddFirst() {
- aLinkedList.addFirst(5);
- assertEquals(5, aLinkedList.get(0));
-
- aLinkedList.addFirst(6);
- assertEquals(6, aLinkedList.get(0));
- assertEquals(5, aLinkedList.get(1));
- assertEquals(2, aLinkedList.size());
- }
-
- @Test
- public void testAddLast() {
- aLinkedList.addLast("hello");
- assertEquals("hello", aLinkedList.get(0));
-
- aLinkedList.addLast("world");
- assertEquals("hello", aLinkedList.get(0));
- assertEquals("world", aLinkedList.get(1));
- assertEquals(2, aLinkedList.size());
- }
-
- @Test
- public void testRemoveFirst() {
- aLinkedList.addLast("hello");
- aLinkedList.addLast("world");
-
- aLinkedList.removeFirst();
- assertEquals("world", aLinkedList.get(0));
- assertEquals(1, aLinkedList.size());
-
- aLinkedList.removeFirst();
- assertEquals(0, aLinkedList.size());
- }
-
- @Test
- public void testRemoveLast() {
- aLinkedList.addFirst("world");
- aLinkedList.addFirst("hello");
-
- aLinkedList.removeLast();
- //assertEquals("hello", aLinkedList.get(0));
- assertEquals(1, aLinkedList.size());
-
- aLinkedList.removeLast();
- assertEquals(0, aLinkedList.size());
- }
-
- @Test
- public void testLinkedListFunctional() {
- for (int i = 1; i < 4; i++) {
- aLinkedList.add(i); // [1,2,3]
- }
- aLinkedList.remove(1); // [1,3]
-
- aLinkedList.add(1, 0); // [1,0,3]
- for (int i=4; i<6; i++) {
- aLinkedList.addFirst(i); // [5, 4, 1, 0, 3]
- }
- assertEquals(5, aLinkedList.size());
- assertEquals(5, aLinkedList.get(0));
- assertEquals(1, aLinkedList.get(2));
- assertEquals(0, aLinkedList.get(3));
-
-
- aLinkedList.remove(3); // [5, 4, 1, 3]
- assertEquals(3, aLinkedList.get(aLinkedList.size()-1));
- aLinkedList.removeLast(); // [5, 4, 1]
- assertEquals(1, aLinkedList.get(aLinkedList.size()-1));
- aLinkedList.removeFirst(); // [4,1]
-
- assertEquals(4, aLinkedList.get(0));
- assertEquals(1, aLinkedList.get(1));
- assertEquals(2, aLinkedList.size());
-
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/ListTest.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/ListTest.java
deleted file mode 100644
index 6959da0421..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/ListTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.github.Ven13.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.*;
-
-import com.github.Ven13.coding2017.basic.ArrayList;
-import com.github.Ven13.coding2017.basic.Iterator;
-import com.github.Ven13.coding2017.basic.List;
-
-public class ListTest {
-
- //protected static List aList;
-
- @Test
- public void testFunctional() {
-
- List aList = new ArrayList();
-
- aList.add(1);
- aList.add(2);
- assertEquals(1, aList.get(0));
- assertEquals(2, aList.get(1));
-
- aList.add(3);
- aList.add(0, 5);
- aList.add(2, 11);
- assertEquals(5, aList.get(0));
- assertEquals(11, aList.get(2));
-
- aList.add("hi");
- assertEquals("hi", aList.get(5));
- assertEquals(6, aList.size());
-
- aList.remove(1);
- assertEquals(11, aList.get(1));
- assertEquals(2, aList.get(2));
-
- assertEquals(5, aList.size());
- }
-
- @Test
- public void testAdd() {
-
- List aList = new ArrayList();
-
- for (int i = 0; i < 100; i++) {
- aList.add(i);
- }
-
- assertEquals(0, aList.get(0));
- assertEquals(99, aList.get(99));
- assertEquals(44, aList.get(44));
- }
-
- @Test
- public void testRemove() {
-
- List aList = new ArrayList();
-
- aList.add(1);
- aList.add(2);
- aList.add(3);
- aList.remove(3);
- assertEquals(2, aList.size());
-
- }
-
- @Test
- public void testSize() {
-
- List aList = new ArrayList();
-
- for (int i = 0; i < 10; i++) {
- aList.add(i * 2);
- }
-
- assertEquals(10, aList.size());
- }
-
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
-
- @Test
- public void testException() {
-
- List aList = new ArrayList();
-
- expectedEx.expect(Exception.class);
-
- aList.remove(1);
- aList.add(3);
- aList.add(2, 5);
- }
-
- @Test
- public void testIterator() {
-
- List aList = new ArrayList();
-
- Iterator it = aList.iterator();
-
- assertEquals(false, it.hasNext());
-
- aList.add(1);
- aList.add(2);
- aList.add(3);
-
- it = aList.iterator();
- assertEquals(true, it.hasNext());
- assertEquals(1, it.next());
- assertEquals(2, it.next());
- assertEquals(3, it.next());
- assertEquals(false, it.hasNext());
-
- aList.remove(1);
- it = aList.iterator();
- assertEquals(true, it.hasNext());
- assertEquals(1, it.next());
- assertEquals(3, it.next());
- assertEquals(false, it.hasNext());
-
- expectedEx.expect(Exception.class);
- it.next();
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/QueueTest.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/QueueTest.java
deleted file mode 100644
index 965610cdce..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/QueueTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.github.Ven13.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.github.Ven13.coding2017.basic.Queue;
-
-public class QueueTest {
-
-private Queue queue;
-
- @Before
- public void setUpQueue() {
- queue = new Queue();
- }
-
- @Test
- public void testQueueFunctional() {
- assertEquals(true, queue.isEmpty());
- queue.enQueue(4);
- queue.enQueue(2);
- assertEquals(2, queue.size());
- assertEquals(false, queue.isEmpty());
-
- int i = (Integer)queue.deQueue();
- assertEquals(4, i);
- i = (Integer)queue.deQueue();
- assertEquals(2, i);
-
- assertEquals(0, queue.size());
- assertEquals(true, queue.isEmpty());
- }
-
-}
diff --git a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/StackTest.java b/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/StackTest.java
deleted file mode 100644
index 9bbf41914f..0000000000
--- a/group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/test/StackTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.github.Ven13.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.github.Ven13.coding2017.basic.Stack;
-
-public class StackTest {
-
-private Stack stack;
-
- @Before
- public void setUpStack() {
- stack = new Stack();
- }
-
- @Test
- public void testStackFunctional() {
- assertEquals(true, stack.isEmpty());
- stack.push(4);
- stack.push(2);
- assertEquals(2, stack.size());
- assertEquals(false, stack.isEmpty());
-
- int i = (Integer)stack.pop();
- assertEquals(2, i);
-
- i = (Integer)stack.peek();
- assertEquals(4, i);
-
- i = (Integer)stack.pop();
- assertEquals(4, i);
-
- assertEquals(0, stack.size());
- assertEquals(true, stack.isEmpty());
- }
-
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/ArrayList.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/ArrayList.java
deleted file mode 100644
index 133db97491..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/ArrayList.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-
-public class ArrayList implements List {
-
- private int size = 0;
-
- private Object[] elementData = new Object[100];
-
- public void add(Object o){
- //容量增加
- ensureCapacity(size + 1);
- //添加
- elementData[size ++] = o;
- }
-
- public void add(int index, Object o){
-
- //检查是否越界
- rangeCheck(index);
- // 进行扩容检查
- ensureCapacity(size + 1);
- // 对数组进行复制处理,目的就是空出index的位置插入element,并将index后的元素位移一个位置
- System. arraycopy(elementData, index, elementData, index + 1,
- size - index);
- // 将指定的index位置赋值为Object o
- elementData[index] = o;
- // 自增一位长度
- size++;
- }
-
- public Object get(int index){
- rangeCheck(index);
- return elementData[index];
- }
-
- public Object remove(int index){
- // 数组越界检查
- rangeCheck(index);
- // 取出要删除位置的元素,供返回使用
- Object oldValue = elementData[index];
- // 计算数组要复制的数量
- int numMoved = size - index - 1;
- // 数组复制,就是将index之后的元素往前移动一个位置
- if (numMoved > 0)
- System. arraycopy(elementData, index+1, elementData, index,
- numMoved);
- // 将数组最后一个元素置空(因为删除了一个元素,然后index后面的元素都向前移动了,所以最后一个就没用了),好让gc尽快回收
- // 不要忘了size减一
- elementData[--size] = null;
- return oldValue;
- }
-
- public int size(){
- return size;
- }
-
- public Iterator iterator(){
- return new ArrayListIterator();
- }
-
- //内部类,实现Iterator
- private class ArrayListIterator implements Iterator{
-
- private int currentIndex = 0; //当前索引
-
- public boolean hasNext() {
- if (currentIndex >= size) {
- return false;
- }
- return true;
- }
-
- public Object next() {
- Object object = elementData[currentIndex];
- currentIndex ++ ;
- return object;
- }
- }
- //扩容
- public void ensureCapacity( int minCapacity) {
- // 当前数组的长度
- int oldCapacity = elementData .length;
- // 最小需要的容量大于当前数组的长度则进行扩容
- if (minCapacity > oldCapacity) {
- // 扩容
- int newCapacity = oldCapacity + (oldCapacity >> 1);
- // 如果新扩容的数组长度还是比最小需要的容量小,则以最小需要的容量为长度进行扩容
- if (newCapacity < minCapacity)
- newCapacity = minCapacity;
- //数组复制
- Object[] elementData2 = new Object[newCapacity];
- for (int i = 0; i < oldCapacity; i++) {
- elementData2[i] = elementData[i];
- }
- elementData = elementData2;
- }
- }
- //检查是否越界
- private void rangeCheck(int index){
- if (index < 0 || index >= this.size) {
- throw new IndexOutOfBoundsException("index :" + index + "size :" + size);
- }
- }
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/BinaryTreeNode.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/BinaryTreeNode.java
deleted file mode 100644
index 6dccc25dcb..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-public class BinaryTreeNode {
-
- private Object data;
- private BinaryTreeNode left;
- private BinaryTreeNode right;
-
- 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;
- }
-
- public BinaryTreeNode insert(Object o){
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Iterator.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Iterator.java
deleted file mode 100644
index 3a1b9abf8c..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Iterator.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-public interface Iterator {
-
- public boolean hasNext();
- public Object next();
-
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/LinkedList.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/LinkedList.java
deleted file mode 100644
index d86e970b8a..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/LinkedList.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-
- private Node head;//头指针
- private Node last;//尾指针
- private int size = 0;
-
- public void add(Object o){
- addLast(o);
- }
-
- public void add(int index , Object o){
- //检查是否越界
- checkIndex(index);
-
- Node indexNode = node(index);
-
- if (index == size) {
- addLast(o);
- } else {
- final Node pred = indexNode.prv;
-
- final Node newNode = new Node();
- newNode.data = o;
- newNode.next = indexNode;
- newNode.prv = pred;
-
- indexNode.prv = newNode;
-
- if (pred == null) {
- head = newNode;
- } else {
- pred.next = newNode;
- }
- }
- size ++;
- }
- public Object get(int index){
- //检查是否越界
- checkIndex(index);
-
- Node indexNode = node(index);
-
- return indexNode.data;
- }
- public Object remove(int index){
- //检查是否越界
- checkIndex(index);
-
- Node indexNode = node(index);
- Object element = indexNode.data;
- Node pre = indexNode.prv;
- Node next = indexNode.next;
-
- if (pre == null) {
- head = next;
- } else {
- pre.next = next;
- indexNode.prv = null;
- }
-
- if (next == null) {
- last = pre;
- } else {
- next.prv = pre;
- indexNode.next = null;
- }
-
- indexNode.data = null;
-
- size --;
-
- return element;
- }
-
- public int size(){
- return size;
- }
-
- public void addFirst(Object o){
- //节点变量存放原来的头指针
- final Node oldHead = head;
- //创建新的节点对象
- final Node newNode = new Node();
- newNode.data = o;
- newNode.next = head;
- newNode.prv = null;
- //判断oldhead是否为null
- if (oldHead == null) {
- last = newNode;
- }else {
- //头指针指向新创建的节点对象
- oldHead.prv = newNode;
- }
- //将newNode变为头指针
- head = newNode;
- size ++;
- }
- public void addLast(Object o){
- //节点新变量放原先的尾指针
- final Node oldLast = last;
- //创建新节点,加入要添加的对象
- final Node newNode = new Node();
- newNode.data = o;
- newNode.next = null;
- newNode.prv = oldLast;
- if (oldLast == null) {
- head = newNode;
- } else {
- //尾指针指向新创建的节点
- oldLast.next = newNode;
- }
- //newNode变为尾指针
- last = newNode;
- size++;
- }
- public Object removeFirst(){
- //通过头指针创建头节点
- final Node hNode = head;
- if (hNode == null) {
- throw new NoSuchElementException();
- }
- final Node next = hNode.next;
- final Object element = hNode.data;
-
- //移除
- hNode.data = null;
- hNode.next = null;
- head = next;
- //判断是否为尾节点
- if (next == null) {
- last = null;
- }else {
- next.prv = null;
- }
- size --;
- return element;
- }
- public Object removeLast(){
- //通过尾指针创建节点
- final Node lastNode = last;
- if (lastNode == null) {
- throw new NoSuchElementException();
- }
- final Object element = lastNode.data;
- final Node prve = lastNode.prv;
-
- //移除
- lastNode.data = null;
- lastNode.prv = null;
- last = prve;
-
- if (prve == null) {
- head = null;
- } else {
- prve.next = null;
- }
- size --;
- return element;
- }
- public Iterator iterator(){
- return new LinkedListIterator();
- }
-
- private class LinkedListIterator implements Iterator{
-
- private Node currentNode = head;//当前节点
-
- public boolean hasNext() {
- if (currentNode == null) {
- return false;
- }
- return true;
- }
-
- public Object next() {
- Object element = currentNode.data;
- currentNode = currentNode.next;
- return element;
- }
-
- }
-
- //查找index节点,并返回该节点
- Node node(int index) {
- // assert isElementIndex(index);
-
- if (index < (size >> 1)) {
- Node x = head;
- for (int i = 0; i < index; i++)
- x = x.next;
- return x;
- } else {
- Node x = last;
- for (int i = size - 1; i > index; i--)
- x = x.prv;
- return x;
- }
- }
- //检查索引
- private void checkIndex(int index){
- if (index < 0 || index > size) {
- throw new IndexOutOfBoundsException();
- }
- }
- private static class Node{
- Object data;
- Node next;
- Node prv;
- }
-}
\ No newline at end of file
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/List.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/List.java
deleted file mode 100644
index ecbb657597..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/List.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-
-public interface List {
- public void add(Object o);
- public void add(int index, Object o);
- public Object get(int index);
- public Object remove(int index);
- public int size();
- public Iterator iterator();
-}
\ No newline at end of file
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Queue.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Queue.java
deleted file mode 100644
index c2661ce35f..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Queue.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-
-public class Queue {
-
- private Node head;//头节点
- private Node last;//尾节点
- private int size;//记录节点
-
- public void enQueue(Object o){
- //设置一个节点变量存放原先的尾节点
- final Node oldLast = last;
- //创建一个新的节点
- Node newNode = new Node();
- newNode.data = o;
- newNode.next = null;
- //添加到队列
- if (isEmpty()) {
- head = newNode;
- } else {
- oldLast.next = newNode;
- }
- //新节点变为尾节点
- last = newNode;
- size ++;
- }
-
- public Object deQueue(){
-
- Object object = head.data;
-
- head = head.next;
-
- if (isEmpty()) {
- last = null;
- }
- size --;
- return object;
- }
-
- public boolean isEmpty(){
- return head == null;
- }
-
- public int size(){
- return size;
- }
-
- private static class Node{
- Object data;
- Node next;
- }
-}
\ No newline at end of file
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Stack.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Stack.java
deleted file mode 100644
index 16684f7d92..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/Stack.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.github.FelixCJF.coding2017.basic;
-
-import java.util.EmptyStackException;
-
-public class Stack {
-
- //存放栈内元素的容器
- private ArrayList elementData = new ArrayList();
- //记录栈内元素个数
-
- public void push(Object o){
- elementData.add(o);
- }
-
- public Object pop(){
- if (isEmpty()) {
- throw new EmptyStackException();
- }
- return elementData.remove(elementData.size() - 1);
- }
-
- public Object peek(){
- if (isEmpty()) {
- throw new EmptyStackException();
- }
- return elementData.get(elementData.size() - 1);
- }
- public boolean isEmpty(){
- return elementData.size() == 0;
- }
- public int size(){
- return elementData.size();
- }
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/ArrayListTest.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/ArrayListTest.java
deleted file mode 100644
index 9484ce1527..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/ArrayListTest.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.github.FelixCJF.coding2017.basic.test;
-
-import org.junit.Before;
-
-import com.github.FelixCJF.coding2017.basic.ArrayList;
-
-public class ArrayListTest extends ListTest {
-
-/* @Before
- public void setUpArrayList() {
- aList = new ArrayList();
- }*/
-
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/LinkedListTest.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/LinkedListTest.java
deleted file mode 100644
index ce0c0d1c0d..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/LinkedListTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.github.FelixCJF.coding2017.basic.test;
-
-
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.github.FelixCJF.coding2017.basic.ArrayList;
-import com.github.FelixCJF.coding2017.basic.LinkedList;
-import com.github.FelixCJF.coding2017.basic.List;
-
-public class LinkedListTest extends ListTest{
-
- private LinkedList aLinkedList;
-
- @Before
- public void setUpLinkedList() {
- List aList = new ArrayList();
- aList = new LinkedList();
- aLinkedList = new LinkedList();
- }
-
- @Test
- public void testAddFirst() {
- aLinkedList.addFirst(5);
- assertEquals(5, aLinkedList.get(0));
-
- aLinkedList.addFirst(6);
- assertEquals(6, aLinkedList.get(0));
- assertEquals(5, aLinkedList.get(1));
- assertEquals(2, aLinkedList.size());
- }
-
- @Test
- public void testAddLast() {
- aLinkedList.addLast("hello");
- assertEquals("hello", aLinkedList.get(0));
-
- aLinkedList.addLast("world");
- assertEquals("hello", aLinkedList.get(0));
- assertEquals("world", aLinkedList.get(1));
- assertEquals(2, aLinkedList.size());
- }
-
- @Test
- public void testRemoveFirst() {
- aLinkedList.addLast("hello");
- aLinkedList.addLast("world");
-
- aLinkedList.removeFirst();
- assertEquals("world", aLinkedList.get(0));
- assertEquals(1, aLinkedList.size());
-
- aLinkedList.removeFirst();
- assertEquals(0, aLinkedList.size());
- }
-
- @Test
- public void testRemoveLast() {
- aLinkedList.addFirst("world");
- aLinkedList.addFirst("hello");
-
- aLinkedList.removeLast();
- assertEquals("hello", aLinkedList.get(0));
- assertEquals(1, aLinkedList.size());
-
- aLinkedList.removeLast();
- assertEquals(0, aLinkedList.size());
- }
-
- @Test
- public void testLinkedListFunctional() {
- for (int i=1; i<4; i++) {
- aLinkedList.add(i); // [1,2,3]
- }
- aLinkedList.remove(1); // [1,3]
-
- aLinkedList.add(1, 0); // [1,0,3]
- for (int i=4; i<6; i++) {
- aLinkedList.addFirst(i); // [5, 4, 1, 0, 3]
- }
- assertEquals(5, aLinkedList.size());
- assertEquals(5, aLinkedList.get(0));
- assertEquals(1, aLinkedList.get(2));
- assertEquals(0, aLinkedList.get(3));
-
- aLinkedList.remove(3); // [5, 4, 1, 3]
- assertEquals(3, aLinkedList.get(aLinkedList.size()-1));
- aLinkedList.removeLast(); // [5, 4, 1]
- assertEquals(1, aLinkedList.get(aLinkedList.size()-1));
- aLinkedList.removeFirst(); // [4,1]
-
- assertEquals(4, aLinkedList.get(0));
- assertEquals(1, aLinkedList.get(1));
- assertEquals(2, aLinkedList.size());
- }
-
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/ListTest.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/ListTest.java
deleted file mode 100644
index b970372bbe..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/ListTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.github.FelixCJF.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import com.github.FelixCJF.coding2017.basic.ArrayList;
-import com.github.FelixCJF.coding2017.basic.Iterator;
-import com.github.FelixCJF.coding2017.basic.List;
-
-public class ListTest {
-
-
- //protected static List aList = new ArrayList();
-
- @Test
- public void testFunctional() {
- List aList = new ArrayList();
- aList.add(1);
- aList.add(2);
- assertEquals(1, aList.get(0));
- assertEquals(2, aList.get(1));
-
- aList.add(3);
- aList.add(0, 5);
- aList.add(2, 11);
- assertEquals(5, aList.get(0));
- assertEquals(11, aList.get(2));
-
- aList.add("hi");
- assertEquals("hi", aList.get(5));
- assertEquals(6, aList.size());
-
- aList.remove(1);
- assertEquals(11, aList.get(1));
- assertEquals(2, aList.get(2));
-
- assertEquals(5, aList.size());
- }
-
- @Test
- public void testAdd() {
- List aList = new ArrayList();
- for (int i=0; i<100; i++)
- aList.add(i);
- assertEquals(0, aList.get(0));
- assertEquals(99, aList.get(99));
- assertEquals(44, aList.get(44));
- }
-
- @Test
- public void testRemove() {
- List aList = new ArrayList();
- aList.add(1);
- aList.add(2);
- aList.add(3);
- int u = (Integer)aList.remove(2);
- assertEquals(3, u);
- assertEquals(2, aList.size());
-
- aList.add(1, 5);
- u = (Integer)aList.remove(0);
- assertEquals(1, u);
- assertEquals(5, aList.get(0));
- assertEquals(2, aList.get(1));
- assertEquals(2, aList.size());
-
- aList.remove(0);
- aList.remove(0);
- assertEquals(0, aList.size());
-
-
- }
-
- @Test
- public void testSize() {
- List aList = new ArrayList();
- for (int i=0; i<10; i++)
- aList.add(i*2);
- assertEquals(10, aList.size());
- }
-
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
-
- @Test
- public void testException() {
- List aList = new ArrayList();
- expectedEx.expect(Exception.class);
-
- aList.remove(1);
- aList.add(3);
- aList.add(2, 5);
- expectedEx.expect(Exception.class);
- }
-
- @Test
- public void testIterator() {
- List aList = new ArrayList();
- Iterator it = aList.iterator();
- assertEquals(false, it.hasNext());
-
- aList.add(1);
- aList.add(2);
- aList.add(3);
-
- it = aList.iterator();
- assertEquals(true, it.hasNext());
- assertEquals(1, it.next());
- assertEquals(2, it.next());
- assertEquals(3, it.next());
- assertEquals(false, it.hasNext());
-
- aList.remove(1);
- it = aList.iterator();
- assertEquals(true, it.hasNext());
- assertEquals(1, it.next());
- assertEquals(3, it.next());
- assertEquals(false, it.hasNext());
- }
-
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/QueueTest.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/QueueTest.java
deleted file mode 100644
index 49506c2b35..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/QueueTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.github.FelixCJF.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.github.FelixCJF.coding2017.basic.Queue;
-
-public class QueueTest {
- private Queue queue;
-
- @Before
- public void setUpQueue() {
- queue = new Queue();
- }
-
- @Test
- public void testQueueFunctional() {
- assertEquals(true, queue.isEmpty());
- queue.enQueue(4);
- queue.enQueue(2);
- assertEquals(2, queue.size());
- assertEquals(false, queue.isEmpty());
-
- int i = (Integer)queue.deQueue();
- assertEquals(4, i);
- i = (Integer)queue.deQueue();
- assertEquals(2, i);
-
- assertEquals(0, queue.size());
- assertEquals(true, queue.isEmpty());
- }
-
-}
diff --git a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/StackTest.java b/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/StackTest.java
deleted file mode 100644
index 6bb53571a5..0000000000
--- a/group02/1554421063/src/com/github/FelixCJF/coding2017/basic/test/StackTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.github.FelixCJF.coding2017.basic.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.github.FelixCJF.coding2017.basic.Stack;
-
-
-public class StackTest {
-
- private Stack stack;
-
- @Before
- public void setUpStack() {
- stack = new Stack();
- }
-
- @Test
- public void testStackFunctional() {
- assertEquals(true, stack.isEmpty());
- stack.push(4);
- stack.push(2);
- assertEquals(2, stack.size());
- assertEquals(false, stack.isEmpty());
-
- int i = (Integer)stack.pop();
- assertEquals(2, i);
-
- i = (Integer)stack.peek();
- assertEquals(4, i);
-
- i = (Integer)stack.pop();
- assertEquals(4, i);
-
- assertEquals(0, stack.size());
- assertEquals(true, stack.isEmpty());
- }
-
-}
diff --git a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java b/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java
deleted file mode 100644
index 03f6710788..0000000000
--- a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyArrayList.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/18.
- */
-public class MyArrayList {
-
- private Object[] initialArray = {};
- private Object[] dataArray;
- private int initSize = 10;
- private int arraySize;
- public MyArrayList() {
- dataArray = initialArray;
- }
-
- public MyArrayList(int init) {
- dataArray = new Object[init];
- }
-
- public void ensureCapacity(int newCapacity) {
- if (newCapacity < arraySize)
- return;
-
- Object[] old = dataArray;
- dataArray = new Object[newCapacity];
- for (int i = 0; i < size(); i++) {
- dataArray[i] = old[i];
- }
- }
-
- public void add(T element) {
- add(size(), element);
- }
-
- public void add(int index, T element) {
- if (size() == dataArray.length) {
- ensureCapacity(size()*2 + 1);
- }
- for(int i=arraySize;i>index;i--) {
- dataArray[i] = dataArray[i - 1];
- }
- dataArray[index] = element;
- arraySize++;
- }
-
- public T delete(int index) {
- if (index < 0 || index > arraySize) {
- throw new ArrayIndexOutOfBoundsException();
- }
- T removeElement = (T)dataArray[index];
- for (int i = index; i < size() -1; i++) {
- dataArray[i] = dataArray[i + 1];
- }
- arraySize--;
- return removeElement;
- }
-
- public T get(int index) {
- if (index < 0 || index > arraySize) {
- throw new ArrayIndexOutOfBoundsException();
- }
- return (T)dataArray[index];
- }
-
- public T set(int index, T newElement) {
- if (index < 0 || index > arraySize) {
- throw new ArrayIndexOutOfBoundsException();
- }
- T oldElement = (T) dataArray[index];
- dataArray[index] = newElement;
-
- return oldElement;
- }
-
- public int size() {
- return arraySize;
- }
-
- public boolean isEmpty() {
- return size() == 0;
- }
-
-}
diff --git a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java b/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java
deleted file mode 100644
index 9e7eab3401..0000000000
--- a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyLinkedList.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/18.
- */
-public class MyLinkedList {
- private class Node {
- public Node pre;
- public Node next;
- public T data;
-
- public Node(Node pre,Node next,T data) {
- this.pre = pre;
- this.next = next;
- this.data = data;
- }
- }
-
- private int dataSize;
-
- private Node head;
- private Node tail;
-
- public MyLinkedList() {
- head = new Node(null,null,null);
- tail = new Node(head, null, null);
- head.next = tail;
- dataSize = 0;
- }
-
- public void add(T t) {
-// add(size(), t);
- Node newNode = new Node<>(null, tail, t);
- newNode.pre = tail.pre;
- tail.pre.next = newNode;
- tail.pre = newNode;
- dataSize++;
-
- }
-
- /**
- * 根据索引添加没有实现
- * @param index
- * @param element
- */
- public void add(int index,T element) {
- //TODO 根据索引添加元素
-// addBefore(getNode(index,0,size()-1),element);
-// if (index == dataSize) {
-// add(element);
-// } else {
- //
-// }
- }
-
- public T get(int index) {
- return getNode(index).data;
- }
-
- public T set(int index, T newValue) {
- Node node = getNode(index);
- T oldData = node.data;
- node.data = newValue;
- return oldData;
- }
-
- public T remove(int index) {
- Node node = getNode(index);
- node.next.pre = node.pre;
- node.pre.next = node.next;
- dataSize--;
-
- return node.data;
-
- }
-
- private void addBefore(Node node, T element) {
-// newNode.pre.next = newNode;
-// node.pre = newNode;
- Node pre = node.pre;
- Node newNode = new Node<>(node.pre, node, element);
- node.pre = newNode;
- pre.next = newNode;
-
- dataSize++;
- }
-
- private Node getNode(int index) {
- return getNode(index, 0, size());
- }
-
- private Node getNode(int index, int lower, int upper) {
- Node p;
- if (index < lower || index > upper) {
- throw new IndexOutOfBoundsException();
- }
-
- if (index < size() / 2) {
- p = head.next;
- for (int i = 0; i < index; i++) {
- p = p.next;
- }
- } else {
- p = tail.pre;
- for (int i = size()-1; i > index; i--) {
- p = p.pre;
- }
- }
- return p;
- }
-
- public int size() {
- return dataSize;
- }
-
- public boolean isEmpty() {
- return size() == 0;
- }
-}
diff --git a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java b/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java
deleted file mode 100644
index 6d0c970b65..0000000000
--- a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyQueue.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/22.
- */
-public class MyQueue {
- private MyLinkedList link = new MyLinkedList<>();
-
- public void enQueue(T t) {
- link.add(t);
- }
-
- public T deQueue() {
- if (size() <= 0) {
- return null;
- }
- T t = link.get(0);
- link.remove(0);
- return t;
- }
-
- public boolean isEmpty() {
- return size() == 0;
- }
-
- public int size() {
- return link.size();
- }
-}
diff --git a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java b/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java
deleted file mode 100644
index 3fd9d2f5c2..0000000000
--- a/group02/435994736/src/main/java/com/github/lhpmatlab/coding2017/basic/MyStack.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-/**
- * Created by andy on 2017/2/22.
- */
-public class MyStack {
- private MyArrayList list = new MyArrayList<>();
-
- public void push(T t) {
- list.add(t);
- }
-
- public T pop() {
- if (size() <= 0) {
- throw new IndexOutOfBoundsException();
- }
- return list.delete(size() - 1);
- }
-
- public T peek() {
- return list.get(size() - 1);
- }
-
- public boolean isEmpty() {
- return list.size() == 0;
- }
- public int size() {
- return list.size();
- }
-}
diff --git a/group02/435994736/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java b/group02/435994736/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java
deleted file mode 100644
index e29d41feac..0000000000
--- a/group02/435994736/src/test/java/com/github/lhpmatlab/coding2017/basic/MyArrayListTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class MyArrayListTest {
- private MyArrayList list;
-
- @Before
- public void init(){
- list = new MyArrayList<>();
- }
-
- @Test
- public void testEnsureCapacity() {
- assertEquals("init list size is 0 ", list.size(), 0);
- list.add("1");
- list.ensureCapacity(10);
- assertEquals("ensureCapacity size is 10 ", list.size(),1);
- }
-
- /**
- * 在列表的末尾添加元素
- */
- @Test
- public void testAddT() {
- assertEquals("init list size is 0 ", list.size(), 0);
- list.add("1");
- list.add("2");
- assertEquals("add list size ", list.size(), 2);
- for (int i=0; i
-* @since ���� 26, 2017
-* @version 1.0
-*/
-public class MyLinkedListTest {
- private MyLinkedList linkedList;
-
- @Before
- public void before() throws Exception {
- linkedList = new MyLinkedList<>();
- }
-
- @After
- public void after() throws Exception {
- }
-
- /**
- *
- * Method: add(T t)
- *
- */
- @Test
- public void testAddT() throws Exception {
- assertEquals("init list size is 0 ", linkedList.size(), 0);
- linkedList.add("1");
- linkedList.add("2");
- assertEquals("add list size ", linkedList.size(), 2);
- for (int i=0; i
-* @since ���� 26, 2017
-* @version 1.0
-*/
-public class MyQueueTest {
- private MyQueue queue;
-
- @Before
- public void init() throws Exception {
- queue = new MyQueue<>();
- }
-
- /**
- *
- * Method: enQueue(T t)
- *
- */
- @Test
- public void testEnQueue() throws Exception {
- queue.enQueue("1");
- assertEquals("size ", queue.size(), 1);
- }
-
- /**
- *
- * Method: deQueue()
- *
- */
- @Test
- public void testDeQueue() throws Exception {
- queue.enQueue("1");
- queue.enQueue("2");
-// queue.deQueue();
- assertEquals("dequeue element ",queue.deQueue(),"1");
- assertEquals("size ", queue.size(), 1);
-
- }
-
- /**
- *
- * Method: isEmpty()
- *
- */
- @Test
- public void testIsEmpty() throws Exception {
- assertEquals("isEmpty method",queue.isEmpty(),true);
- }
-
- /**
- *
- * Method: size()
- *
- */
- @Test
- public void testSize() throws Exception {
- queue.enQueue("1");
- queue.enQueue("2");
- assertEquals("size method", queue.size(),2);
- }
-
-
-}
diff --git a/group02/435994736/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java b/group02/435994736/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java
deleted file mode 100644
index a90af5d720..0000000000
--- a/group02/435994736/src/test/java/com/github/lhpmatlab/coding2017/basic/MyStackTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.github.lhpmatlab.coding2017.basic;
-
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
-
-import static org.junit.Assert.*;
-
-/**
-* MyStack Tester.
-*
-* @author
-* @since ���� 26, 2017
-* @version 1.0
-*/
-public class MyStackTest {
-
- MyStack stack;
-
-
- @Before
- public void init() throws Exception {
- stack = new MyStack<>();
- }
-
- @After
- public void after() throws Exception {
- }
-
- /**
- *
- * Method: push(T t)
- *
- */
- @Test
- public void testPush() throws Exception {
- assertEquals("init stack ", stack.size(), 0);
- stack.push("1");
- assertEquals("pust stack ", stack.size(),1);
- }
-
- /**
- *
- * Method: pop()
- *
- */
- @Test
- public void testPop() throws Exception {
- assertEquals("init stack ", stack.size(), 0);
- stack.push("1");
- stack.push("2");
- stack.pop();
- assertEquals("after pop ",stack.size(),1);
- }
-
- /**
- *
- * Method: peek()
- *
- */
- @Test
- public void testPeek() throws Exception {
- assertEquals("init stack ", stack.size(), 0);
- stack.push("1");
- stack.push("2");
- assertEquals("peek ", stack.peek(),"2");
- }
-
- /**
- *测试判空方法
- * Method: isEmpty()
- *
- */
- @Test
- public void testIsEmpty() throws Exception {
- assertEquals("stack is empty ", stack.isEmpty(), true);
- }
-
- /**
- *测试判空方法,不为空的情况
- * Method: isEmpty()
- *
- */
- @Test
- public void testIsNotEmpty() throws Exception {
- stack.push("1");
- assertEquals("stack is empty ", stack.isEmpty(), false);
- }
-
- /**
- *
- * Method: size()
- *
- */
- @Test
- public void testSize() throws Exception {
- assertEquals("init stack ", stack.size(), 0);
- stack.push("1");
- stack.push("2");
- assertEquals("size is 2", stack.size(), 2);
- }
-
-
-}
diff --git a/group02/527705641/.gitignore b/group02/527705641/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group02/527705641/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group02/527705641/src/com/github/fei9009/coding2017/basic/ArrayList.java b/group02/527705641/src/com/github/fei9009/coding2017/basic/ArrayList.java
deleted file mode 100644
index 855e25b257..0000000000
--- a/group02/527705641/src/com/github/fei9009/coding2017/basic/ArrayList.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.github.fei9009.coding2017.basic;
-
-public class ArrayList implements List {
-
- private int size = 0;
- private int capacity;
-
- private Object[] elementData = new Object[100];
-
- public ArrayList() {
- this.capacity = 20;
- }
-
- private void extend() {
- Object[] updatedElementData = new Object[this.elementData.length + this.capacity];
- System.arraycopy(this.elementData, 0, updatedElementData, 0, this.elementData.length);
- this.elementData = updatedElementData;
- }
-
- public void add(Object o){
- if (this.size == elementData.length) {
- extend();
- }
- elementData[size] = o;
- this.size++;
- }
-
- public void add(int index, Object o){
- if (this.size == elementData.length) {
- extend();
- }
- int i;
- for (i = this.size - 1; i >= index; i--) {
- this.elementData[i + 1] = this.elementData[i];
- }
- this.elementData[i + 1] = o;
- this.size++;
- }
-
- public Object get(int index){
- if (index >= 0 && index < this.size) {
- return this.elementData[index];
- }else {
- return null;
- }
- }
-
- public Object remove(int index){
- if (index >= 0 && index < this.size) {
- int i = 0;
- Object deletedElement = this.elementData[index];
- for (i = index + 1; i < this.size; i++) {
- this.elementData[i - 1] = this.elementData[i];
- }
- this.elementData[i] = null;
- this.size--;
- return deletedElement;
- }else {
- return null;
- }
- }
-
- public int size(){
- return this.size;
- }
-
- public Iterator iterator(){
- return null;
- }
-
-}
diff --git a/group02/527705641/src/com/github/fei9009/coding2017/basic/ArrayListTest.java b/group02/527705641/src/com/github/fei9009/coding2017/basic/ArrayListTest.java
deleted file mode 100644
index d623dd05e0..0000000000
--- a/group02/527705641/src/com/github/fei9009/coding2017/basic/ArrayListTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.github.fei9009.coding2017.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ArrayListTest {
-
- private static ArrayList testArray = new ArrayList();
- @Before
- public void setUp() throws Exception {
- //testArray.clear();
- }
-
- @Test
- public void testArrayList() {
- //fail("Not yet implemented");
- }
-
- @Test
- public void testAddObject() {
- testArray.add(10);
- assertEquals(10, testArray.get(0));
- //fail("Not yet implemented");
- }
-
- @Test
- public void testAddIntObject() {
- testArray.add(10);
- testArray.add(0, 3);
- testArray.add(0, 2);
- assertEquals(3, testArray.get(1));
- assertEquals(2, testArray.get(0));
- //fail("Not yet implemented");
- }
-
- @Test
- public void testGet() {
- testArray.add(10);
- assertEquals(10, testArray.get(0));
- //fail("Not yet implemented");
- }
-
- @Test
- public void testRemove() {
- fail("Not yet implemented");
- }
-
- @Test
- public void testSize() {
- fail("Not yet implemented");
- }
-
-}
diff --git a/group02/527705641/src/com/github/fei9009/coding2017/basic/BinaryTreeNode.java b/group02/527705641/src/com/github/fei9009/coding2017/basic/BinaryTreeNode.java
deleted file mode 100644
index 6dbc7ee012..0000000000
--- a/group02/527705641/src/com/github/fei9009/coding2017/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.github.fei9009.coding2017.basic;
-
-public class BinaryTreeNode