From 5f8f4473bd01bccc1a95a918033d87d60292d60d Mon Sep 17 00:00:00 2001 From: kai Date: Fri, 24 Feb 2017 10:39:26 +0800 Subject: [PATCH 01/68] first commit --- group06/1378560653/.classpath | 6 ++++++ group06/1378560653/.gitignore | 1 + group06/1378560653/.project | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 group06/1378560653/.classpath create mode 100644 group06/1378560653/.gitignore create mode 100644 group06/1378560653/.project diff --git a/group06/1378560653/.classpath b/group06/1378560653/.classpath new file mode 100644 index 0000000000..fb5011632c --- /dev/null +++ b/group06/1378560653/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/group06/1378560653/.gitignore b/group06/1378560653/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/group06/1378560653/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/group06/1378560653/.project b/group06/1378560653/.project new file mode 100644 index 0000000000..0feed82399 --- /dev/null +++ b/group06/1378560653/.project @@ -0,0 +1,17 @@ + + + 1378560653Learning + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + From 300feeacf433b3ae5ee8cb7eb694800d7bff5ba8 Mon Sep 17 00:00:00 2001 From: "yanght1454385822@qq.com" Date: Fri, 24 Feb 2017 13:56:33 +0800 Subject: [PATCH 02/68] homework --- group06/1454385822/.classpath | 6 + group06/1454385822/.gitignore | 1 + group06/1454385822/.project | 17 ++ .../src/com/coding/basic/ArrayList.java | 124 +++++++++ .../src/com/coding/basic/BinaryTreeNode.java | 65 +++++ .../src/com/coding/basic/Iterator.java | 8 + .../src/com/coding/basic/LinkedList.java | 241 ++++++++++++++++++ .../1454385822/src/com/coding/basic/List.java | 11 + .../src/com/coding/basic/Queue.java | 42 +++ .../src/com/coding/basic/Stack.java | 42 +++ 10 files changed, 557 insertions(+) create mode 100644 group06/1454385822/.classpath create mode 100644 group06/1454385822/.gitignore create mode 100644 group06/1454385822/.project create mode 100644 group06/1454385822/src/com/coding/basic/ArrayList.java create mode 100644 group06/1454385822/src/com/coding/basic/BinaryTreeNode.java create mode 100644 group06/1454385822/src/com/coding/basic/Iterator.java create mode 100644 group06/1454385822/src/com/coding/basic/LinkedList.java create mode 100644 group06/1454385822/src/com/coding/basic/List.java create mode 100644 group06/1454385822/src/com/coding/basic/Queue.java create mode 100644 group06/1454385822/src/com/coding/basic/Stack.java diff --git a/group06/1454385822/.classpath b/group06/1454385822/.classpath new file mode 100644 index 0000000000..fb5011632c --- /dev/null +++ b/group06/1454385822/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/group06/1454385822/.gitignore b/group06/1454385822/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/group06/1454385822/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/group06/1454385822/.project b/group06/1454385822/.project new file mode 100644 index 0000000000..35750341bb --- /dev/null +++ b/group06/1454385822/.project @@ -0,0 +1,17 @@ + + + 1454385822Learning + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/group06/1454385822/src/com/coding/basic/ArrayList.java b/group06/1454385822/src/com/coding/basic/ArrayList.java new file mode 100644 index 0000000000..571ca71f21 --- /dev/null +++ b/group06/1454385822/src/com/coding/basic/ArrayList.java @@ -0,0 +1,124 @@ +package com.coding.basic; + +import java.util.Arrays; + +public class ArrayList implements List { + + private int size = 0; + + private int pos = 0; // 当前数组的末尾元素的下一位置 + + private Object[] elementData = new Object[3]; + + public void add(Object o){ + + if(pos >= elementData.length - 1){ + //数组扩容1/3 + elementData = Arrays.copyOf(elementData, elementData.length + elementData.length/3); + } + elementData[pos++] = o; + + } + public void add(int index, Object o){ + + if(pos >= elementData.length - 1){ + //数组扩容1/3 + elementData = Arrays.copyOf(elementData, elementData.length + elementData.length/3); + } + /* + * 情况1.index < pos && pos < elementData.length - 1 + * index 只能在pos前面 + */ + if(index <= pos && pos <= elementData.length - 1){ + Object[] tem = new Object[pos - index]; + System.arraycopy(elementData, index, tem, 0, tem.length); + elementData[index] = o; + System.arraycopy(tem, 0, elementData, index + 1, tem.length); + pos++; + }else{ + throw new IndexOutOfBoundsException(); + } + + + + } + + public Object get(int index){ + if(index < pos){ + return elementData[index]; + } + throw new IndexOutOfBoundsException(); + } + + public Object remove(int index){ + Object result; + //将数字删除并将该数字后面的元素向前移动一位 + if(index < pos ){ //只有index在pos之前才进行删除操作 + result = elementData[index]; + if(pos - index > 1){ //删除的不是最后一个元素 + Object[] tem = new Object[pos - index - 1]; + System.arraycopy(elementData, index + 1, tem, 0, tem.length); + for(int i=0; i i2 ? 1 : (i1 == i2 ? 0 : -1); +// return result; +// } +// +//} diff --git a/group06/1454385822/src/com/coding/basic/Iterator.java b/group06/1454385822/src/com/coding/basic/Iterator.java new file mode 100644 index 0000000000..d2e7a2c23c --- /dev/null +++ b/group06/1454385822/src/com/coding/basic/Iterator.java @@ -0,0 +1,8 @@ +package com.coding.basic; + +public interface Iterator { + + public boolean hasNext(); + public Object next(); + +} diff --git a/group06/1454385822/src/com/coding/basic/LinkedList.java b/group06/1454385822/src/com/coding/basic/LinkedList.java new file mode 100644 index 0000000000..6197b9fb35 --- /dev/null +++ b/group06/1454385822/src/com/coding/basic/LinkedList.java @@ -0,0 +1,241 @@ +package com.coding.basic; + + +public class LinkedList implements List{ + + //private Node head; + private Node pre; //指向当前结点的前一个元素 + private Node pHead; //头节点指向第一个元素 + private Node cur; //指向链表的最后一个元素 + private int num = 0; //链表中的元素个数 + + public void add(Object o){ + Node node = new Node(); + node.data = o; + if(pHead == null){ //链表为空,从第一个元素添加 + pHead = cur = node; + pHead.pre = null; + }else{ + node.pre = cur; //前一结点向后移动一位 + cur.next = node; // 添加元素 + cur = cur.next; //当前结点向后移动一位 + } + num++; //链表数目增1 + } + + /** + * 根据索引找到对应的结点 + * @param index + * @return + */ + public Node findNode(int index){ + Node node = pHead; + int tem = 0; + while(tem++ != index){ + node = node.next; + } + return node; + } + + public void add(int index , Object o){ + if(num == 0 || index == num){ + add(o); + return; + } + if(index <= num-1 && index > 0){ + Node node = new Node(); + node.data = o; + Node tem = findNode(index); + Node preNode = tem.pre; + Node posNode = tem.next; + preNode.next = node; + node.next = posNode; + posNode.pre = node; + num++; + return; + } + if(index == 0){ + Node node = new Node(); + node.data = o; + pHead.pre = node; + node.next = pHead; + pHead = node; + num++; + return; + } + throw new IndexOutOfBoundsException(); + } + public Object get(int index){ + if(index <= num - 1 && index >= 0){ + return findNode(index).data; + } + throw new IndexOutOfBoundsException(); + } + + public Object remove(int index){ + Object result; + if(index >0 && index < num - 1){ //删除链表中间的元素 + Node node = findNode(index); + result = node.data; + Node preNode = node.pre; + Node posNode = node.next; + preNode.next = posNode; + posNode.pre = preNode; + num--; + return result; + } + if(index == 0 && num > 0){ //删除第一个元素 + Node node = pHead.next; + result = pHead.data; + node.pre = null; + pHead = node; + num--; + return result; + } + if(index == num - 1 && num > 0){ //删除最后一个元素 + result = cur.data; + cur = cur.pre; + cur.next = null; + num--; + return result; + } + throw new IndexOutOfBoundsException(); + } + + public int size(){ + return num; + } + + public void addFirst(Object o){ + if(num == 0){ + add(o); + return; + } + if(num > 0){ + Node node = new Node(); + node.data = o; + node.pre = null; + node.next = pHead; + pHead = node; + num++; + return; + } + throw new IndexOutOfBoundsException(); + + } + public void addLast(Object o){ + if(num == 0){ + add(o); + return; + } + if(num > 0){ + Node node = new Node(); + node.data = o; + node.pre = cur; + cur.next = node; + node.next = null; + cur = node; + num++; + return; + } + throw new IndexOutOfBoundsException(); + } + public Object removeFirst(){ + Object result; + if(num > 0){ + result = pHead.data; + if(num == 1){ + pHead = null; + num = 0; + } + if(num > 1){ + pHead = pHead.next; + pHead.pre = null; + num--; + } + return result; + } + throw new IndexOutOfBoundsException(); + } + + public Object removeLast(){ + Object result; + if(num == 1){ + result = pHead.data; + pHead = null; + num = 0; + return result; + } + if(num > 1){ + + result = cur.data; + cur = cur.pre; + cur.next = null; + num--; + return result; + } + throw new IndexOutOfBoundsException(); + } + public Iterator iterator(){ + return new Iterator(){ + int cur = 0; + Node node = pHead; + @Override + public boolean hasNext() { + if(cur++ < num){ + return true; + } + return false; + } + + @Override + public Object next() { + Object result = node.data; + node = node.next; + return result; + } + + }; + } + + + private static class Node{ + Object data; + Node pre; + Node next; + + } + + public static void main(String[]args){ + LinkedList list = new LinkedList(); + list.add(1); +// list.add(2); +// list.add(3); +// list.add(4); +// list.add(0, 0); +// list.addFirst(0); +// list.addLast(5); +// list.removeFirst(); + System.out.println(list.removeLast()); + Iterator it = list.iterator(); + while(it.hasNext()){ + System.out.println(it.next()); + } + } + +} + + + + + + + + + + + + + + + diff --git a/group06/1454385822/src/com/coding/basic/List.java b/group06/1454385822/src/com/coding/basic/List.java new file mode 100644 index 0000000000..1fd3aa61b3 --- /dev/null +++ b/group06/1454385822/src/com/coding/basic/List.java @@ -0,0 +1,11 @@ +package com.coding.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/group06/1454385822/src/com/coding/basic/Queue.java b/group06/1454385822/src/com/coding/basic/Queue.java new file mode 100644 index 0000000000..c77317ef21 --- /dev/null +++ b/group06/1454385822/src/com/coding/basic/Queue.java @@ -0,0 +1,42 @@ +package com.coding.basic; + +public class Queue { + + private LinkedList elementData = new LinkedList(); + private int num = 0; + + public void enQueue(Object o){ + elementData.add(o); + num++; + } + + public Object deQueue(){ + num--; + return elementData.removeFirst(); + } + + public boolean isEmpty(){ + return num <= 0; + } + + public int size(){ + return num; + } + + public static void main(String[] args) { + Queue queue = new Queue(); + queue.enQueue(1); + queue.enQueue(2); + queue.enQueue(3); + queue.enQueue(4); + System.out.println("当前队列的长度为:"+queue.size()); + while(!queue.isEmpty()){ + System.out.println(queue.deQueue()); + } + + } + +} + + + diff --git a/group06/1454385822/src/com/coding/basic/Stack.java b/group06/1454385822/src/com/coding/basic/Stack.java new file mode 100644 index 0000000000..2900430728 --- /dev/null +++ b/group06/1454385822/src/com/coding/basic/Stack.java @@ -0,0 +1,42 @@ +package com.coding.basic; + +public class Stack { + private ArrayList elementData = new ArrayList(); + private int num = 0; + + public void push(Object o){ + elementData.add(o); + num++; + } + + public Object pop(){ + + return elementData.remove(--num) ; + } + + public Object peek(){ + return elementData.get(num - 1); + } + public boolean isEmpty(){ + return num <= 0 ; + } + public int size(){ + return num; + } + public static void main(String[] args) { + Stack stack = new Stack(); + stack.push(1); + stack.push(2); + stack.push(3); + stack.push(4); + System.out.println(stack.peek()); + System.out.println(stack.size()); +// while(!stack.isEmpty()){ +// System.out.println(stack.pop()); +// } + } +} + + + + From 07940f8b889f1c6ae66b294d5d2324e98c68af2d Mon Sep 17 00:00:00 2001 From: "yanght1454385822@qq.com" Date: Fri, 24 Feb 2017 18:29:57 +0800 Subject: [PATCH 03/68] =?UTF-8?q?cpu=20=EF=BC=8C=20memory=20=20=EF=BC=8C?= =?UTF-8?q?=20hard=20disk,=20=20=20=20order=20=20=20's=20=20common?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...64\347\232\204\345\205\263\347\263\273.docx" | Bin 0 -> 26679 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "group06/1454385822/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" diff --git "a/group06/1454385822/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" "b/group06/1454385822/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" new file mode 100644 index 0000000000000000000000000000000000000000..4399ea1b1d304b3993c28506ca305ac873f5f609 GIT binary patch literal 26679 zcmeFZWmr|~x-dK@jiex50s_(@APu5)H%KG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30 +0800 Subject: [PATCH 04/68] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=92=8C=E6=96=87?= =?UTF-8?q?=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {liuxin => group06/949319266}/.classpath | 13 +- {liuxin => group06/949319266}/.project | 34 ++--- .../.settings/org.eclipse.jdt.core.prefs | 23 +-- .../src/com/coding/basic/ArrayList.java | 93 ++++++++++++ .../src/com/coding/basic/BinaryTreeNode.java | 100 +++++++++++++ .../src/com/coding/basic/LinkedList.java | 133 ++++++++++++++++++ .../949319266/src/com/coding/basic/List.java | 13 ++ .../949319266/src/com/coding/basic/Queue.java | 52 +++++++ .../949319266/src/com/coding/basic/Stack.java | 36 +++++ .../com/coding/basic/test/ArrayListTest.java | 39 +++++ .../com/coding/basic/test/LinkedListTest.java | 24 ++++ .../src/com/coding/basic/test/QueueTest.java | 28 ++++ .../src/com/coding/basic/test/StackTest.java | 26 ++++ .../949319266/\346\226\207\347\253\240.txt" | 1 + liuxin/.gitignore | 1 - liuxin/src/com/coding/basic/ArrayList.java | 32 ----- .../src/com/coding/basic/BinaryTreeNode.java | 32 ----- liuxin/src/com/coding/basic/Iterator.java | 7 - liuxin/src/com/coding/basic/LinkedList.java | 46 ------ liuxin/src/com/coding/basic/List.java | 9 -- liuxin/src/com/coding/basic/Queue.java | 19 --- liuxin/src/com/coding/basic/Stack.java | 22 --- 22 files changed, 581 insertions(+), 202 deletions(-) rename {liuxin => group06/949319266}/.classpath (73%) rename {liuxin => group06/949319266}/.project (89%) rename {liuxin => group06/949319266}/.settings/org.eclipse.jdt.core.prefs (70%) create mode 100644 group06/949319266/src/com/coding/basic/ArrayList.java create mode 100644 group06/949319266/src/com/coding/basic/BinaryTreeNode.java create mode 100644 group06/949319266/src/com/coding/basic/LinkedList.java create mode 100644 group06/949319266/src/com/coding/basic/List.java create mode 100644 group06/949319266/src/com/coding/basic/Queue.java create mode 100644 group06/949319266/src/com/coding/basic/Stack.java create mode 100644 group06/949319266/src/com/coding/basic/test/ArrayListTest.java create mode 100644 group06/949319266/src/com/coding/basic/test/LinkedListTest.java create mode 100644 group06/949319266/src/com/coding/basic/test/QueueTest.java create mode 100644 group06/949319266/src/com/coding/basic/test/StackTest.java create mode 100644 "group06/949319266/\346\226\207\347\253\240.txt" delete mode 100644 liuxin/.gitignore delete mode 100644 liuxin/src/com/coding/basic/ArrayList.java delete mode 100644 liuxin/src/com/coding/basic/BinaryTreeNode.java delete mode 100644 liuxin/src/com/coding/basic/Iterator.java delete mode 100644 liuxin/src/com/coding/basic/LinkedList.java delete mode 100644 liuxin/src/com/coding/basic/List.java delete mode 100644 liuxin/src/com/coding/basic/Queue.java delete mode 100644 liuxin/src/com/coding/basic/Stack.java diff --git a/liuxin/.classpath b/group06/949319266/.classpath similarity index 73% rename from liuxin/.classpath rename to group06/949319266/.classpath index fceb4801b5..a7a9bf927c 100644 --- a/liuxin/.classpath +++ b/group06/949319266/.classpath @@ -1,6 +1,7 @@ - - - - - - + + + + + + + diff --git a/liuxin/.project b/group06/949319266/.project similarity index 89% rename from liuxin/.project rename to group06/949319266/.project index fab8d7f04c..d3a5c7c636 100644 --- a/liuxin/.project +++ b/group06/949319266/.project @@ -1,17 +1,17 @@ - - - 2017Learning - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - + + + algorithm + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/liuxin/.settings/org.eclipse.jdt.core.prefs b/group06/949319266/.settings/org.eclipse.jdt.core.prefs similarity index 70% rename from liuxin/.settings/org.eclipse.jdt.core.prefs rename to group06/949319266/.settings/org.eclipse.jdt.core.prefs index 3a21537071..500f6b26f4 100644 --- a/liuxin/.settings/org.eclipse.jdt.core.prefs +++ b/group06/949319266/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,12 @@ -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 +#Fri Feb 24 09:38:47 CST 2017 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/group06/949319266/src/com/coding/basic/ArrayList.java b/group06/949319266/src/com/coding/basic/ArrayList.java new file mode 100644 index 0000000000..9d2dca03c2 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/ArrayList.java @@ -0,0 +1,93 @@ +package com.coding.basic; + +import java.util.Iterator; + +public class ArrayList implements List { + + private int size; + private int current ; + private int point; + private Object[] elementData = null; + private static final int DEFAULT_SIZE=100; + + public ArrayList() { + this(DEFAULT_SIZE); + } + + public ArrayList(int size) { + if(size < 0) { + System.out.println("СС0"); + } else { + this.elementData = new Object[size]; + this.current = 0; + point = size; + } + } + + public void add(E e){ + judgeSize(); + this.elementData[current] = e; + this.current++; + } + public void add(int index, E e){ + judgeIndex(index); + for(int i=0 ; i= index && i+2 < elementData.length) { + elementData[i] = e; + elementData[i+1] = elementData[i+2]; + } + } + current++; + } + + public E get(int index){ + judgeIndex(index); + return (E)this.elementData[index]; + } + + public void remove(int index) { + judgeIndex(index); + for(int i=0;i0) { + return true; + } + return false; + } + public void clear() { + elementData = new Object[DEFAULT_SIZE]; + } + private void judgeSize() { + Object[] newarr = new Object[elementData.length + DEFAULT_SIZE]; + System.arraycopy(elementData, 0, newarr, 0, elementData.length); + this.elementData = newarr; + } + public void judgeIndex(int index) { + if(index < 0 || index > point) { + System.out.println("±Խ"); + } + } + +} diff --git a/group06/949319266/src/com/coding/basic/BinaryTreeNode.java b/group06/949319266/src/com/coding/basic/BinaryTreeNode.java new file mode 100644 index 0000000000..941c31bc66 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/BinaryTreeNode.java @@ -0,0 +1,100 @@ +package com.coding.basic; + +public class BinaryTreeNode { + + private int data; + private BinaryTreeNode left; + private BinaryTreeNode right; + private BinaryTreeNode root; + + public BinaryTreeNode getRoot() { + return root; + } + + public Object getData() { + return data; + } + public void setData(int 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 void insert(int value){ + BinaryTreeNode newNode = new BinaryTreeNode(); + if(root == null) { + root=newNode; + root.left = null; + root.right = null; + } else { + BinaryTreeNode currentNode = root; + BinaryTreeNode parentNode; + while(true) { + parentNode = currentNode; + if(newNode.data > currentNode.data) { + currentNode = currentNode.getRight(); + if(currentNode == null) { + parentNode.setRight(newNode); + return; + } + } else { + currentNode = currentNode.getLeft(); + if(currentNode == null) { + parentNode.setLeft(newNode); + return; + } + } + } + + } + } + public boolean find(int key) { + BinaryTreeNode cNode = root; + if(cNode != null) { + while(cNode.data != key) { + if(cNode.data > key) { + cNode = cNode.getLeft(); + } else { + cNode = cNode.getRight(); + } + return true; + } + return true; + } + return false; + } + // + public void inOrder(BinaryTreeNode treeNode) { + if(treeNode != null) { + inOrder(treeNode.getLeft()); + System.out.println(treeNode.data); + inOrder(treeNode.getRight()); + } + } + // + public void leftOrder(BinaryTreeNode treeNode) { + if(treeNode != null) { + leftOrder(treeNode.getLeft()); + System.out.println(treeNode.data); + leftOrder(treeNode.getRight()); + } + } + // + public void rightOrder(BinaryTreeNode treeNode) { + if(treeNode != null) { + rightOrder(treeNode.getLeft()); + System.out.println(treeNode.data); + rightOrder(treeNode.getRight()); + } + } +} diff --git a/group06/949319266/src/com/coding/basic/LinkedList.java b/group06/949319266/src/com/coding/basic/LinkedList.java new file mode 100644 index 0000000000..ee95a118e0 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/LinkedList.java @@ -0,0 +1,133 @@ +package com.coding.basic; + +import java.util.Iterator; + +public class LinkedList implements List { + + private Node last; + private Node head; + private int xsize = 0; + + public LinkedList() { + init(); + } + + private void init() { + head = new Node(null,null,null); + last = new Node(null,head,null); + head.next = last; + xsize = 0; + } + + //һڲʹ;index֮ǰһڵ + private void add(Node node,int index) { + if(index < 0 || index > xsize) { + throw new IndexOutOfBoundsException("±Խ"); + } + node.pre = getNode(index-1); + getNode(index-1).next = node; + node.next = getNode(index); + getNode(index).pre = node; + xsize++; + } + public void add(E e){ + add(new Node(e,null,null),xsize); + } + + public void add(int index,E e){ + add(new Node(e,null,null),index); + } + private Node getNode(int index){ + Node newNode; + int current; + if(index == -1) { + return head; + } else if (index == xsize ){ + return last; + } else { + current = 0; + newNode = head.next; + while (current < index) { + newNode = newNode.next; + current++; + } + } + return newNode; + } + + public E get(int index) { + return getNode(index).e; + } + + public void remove(int index){ + Node node = getNode(index); + node.pre.next = node.next; + node.next.pre=node.pre; + xsize--; + } + + public int size(){ + return xsize; + } + + public void addFirst(E e){ + add(new Node(e,null,null),0); + } + public void addLast(E e){ + add(new Node(e,null,null),xsize); + } + public void removeFirst(){ + remove(0); + } + public void removeLast(){ + remove(xsize); + } + public Iterator iterator(){ + return null; + } + + private static class Node{ + public E e; + Node next; + Node pre; + public Node (E e,Node pre,Node next) { + this.pre = pre; + this.next = next; + this.e = e; + } + + } + + + public boolean contains(Node node) { + Node mnode = head.next; + while(mnode !=null) { + if(mnode.equals(node)) { + return true; + } + mnode = mnode.next; + } + return false; + } + public boolean isEmpty() { + return xsize == 0 ? true:false; + } + public void clear() { + init(); + } + + public boolean contains(E e) { + // TODO Auto-generated method stub + Node node = null; + while((node=(head.next)) != null) { + if(e.equals(node)) { + return true; + } else { + node = node.next; + } + } + return false; + } + + +} diff --git a/group06/949319266/src/com/coding/basic/List.java b/group06/949319266/src/com/coding/basic/List.java new file mode 100644 index 0000000000..970c0cfc66 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/List.java @@ -0,0 +1,13 @@ +package com.coding.basic; + + +public interface List { + public void add(E e); + public void add(int index, E e); + //public E get(int index); + public void remove(int index); + public boolean contains(E e); + public int size(); + public boolean isEmpty(); + public void clear(); +} diff --git a/group06/949319266/src/com/coding/basic/Queue.java b/group06/949319266/src/com/coding/basic/Queue.java new file mode 100644 index 0000000000..b090a3626e --- /dev/null +++ b/group06/949319266/src/com/coding/basic/Queue.java @@ -0,0 +1,52 @@ +package com.coding.basic; + +import java.util.ArrayList; + +public class Queue { + E[] element; + //Ϊ˲ԷʱΪ5 + private static final int DEFAULT_SIZE=5; + int front,rear;//ֱΪ׺Ͷβ± + + public Queue() { + this(DEFAULT_SIZE); + } + public Queue(int size) { + element = (E[])(new Object[size]); + front = 0; + rear = 0; + } + + public void enQueue(E e){ + if(((rear+1)%element.length) == front) { + System.out.println("޷"); + } else { + element[rear] = e; + rear=(rear+1)%element.length; + } + } + + public E deQueue(){ + if(rear == front) { + return null; + } else { + E e = element[front]; + front = (front + 1)%element.length; + return e; + } + + } + + public boolean isEmpty(){ + return rear == front; + } + + public int size(){ + if(rear > front){ + return rear-front; + } else { + return (element.length+1)-(front-rear); + } + } + +} diff --git a/group06/949319266/src/com/coding/basic/Stack.java b/group06/949319266/src/com/coding/basic/Stack.java new file mode 100644 index 0000000000..2a309fde95 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/Stack.java @@ -0,0 +1,36 @@ +package com.coding.basic; + +import java.util.ArrayList; + +public class Stack { + private ArrayList element; + int top; + public Stack() { + element = new ArrayList(); + top = 0; + } + + public void push(Object o){ + element.add(o); + top++; + } + + public void pop(){ + if(isEmpty()) { + System.out.println("ջǿյ"); + System.exit(0); + } + element.remove(top-1); + top--; + } + + public Object peek(){ + return element.get(top-1); + } + public boolean isEmpty(){ + return top == 0?true:false; + } + public int size(){ + return top; + } +} diff --git a/group06/949319266/src/com/coding/basic/test/ArrayListTest.java b/group06/949319266/src/com/coding/basic/test/ArrayListTest.java new file mode 100644 index 0000000000..5abd16725f --- /dev/null +++ b/group06/949319266/src/com/coding/basic/test/ArrayListTest.java @@ -0,0 +1,39 @@ +package com.coding.basic.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.coding.basic.ArrayList; + +public class ArrayListTest { + + @Test + public void test() { + ArrayList list = new ArrayList(); + + list.add("a"); + list.add("b"); + list.add("c"); + list.add("d"); + + System.out.println("±Ϊ3ԪΪ"+list.get(3)); + System.out.println("鳤"+list.size()); + list.remove(2); + System.out.println("remove鳤"+list.size()); + + for(int i = 0; i < list.size() ; i++) { + System.out.print(list.get(i)+","); + } + list.add(3, "g"); + System.out.println(""); + System.out.println("Ϊ"); + + for(int i = 0; i < list.size() ; i++) { + System.out.print(list.get(i)+","); + } + + + } + +} diff --git a/group06/949319266/src/com/coding/basic/test/LinkedListTest.java b/group06/949319266/src/com/coding/basic/test/LinkedListTest.java new file mode 100644 index 0000000000..2b4c390721 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/test/LinkedListTest.java @@ -0,0 +1,24 @@ +package com.coding.basic.test; + +import static org.junit.Assert.*; + +import java.util.Iterator; + +import org.junit.Test; + +import com.coding.basic.LinkedList; + +public class LinkedListTest { + + @Test + public void test() { + LinkedList list = new LinkedList(); + list.add("First"); + list.add("Second"); + list.add("Thrid"); + for(int i = 0; i < list.size(); i++) { + System.out.print(list.get(i)+ " "); + } + + } +} diff --git a/group06/949319266/src/com/coding/basic/test/QueueTest.java b/group06/949319266/src/com/coding/basic/test/QueueTest.java new file mode 100644 index 0000000000..6ec8036c35 --- /dev/null +++ b/group06/949319266/src/com/coding/basic/test/QueueTest.java @@ -0,0 +1,28 @@ +package com.coding.basic.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.coding.basic.Queue; + +public class QueueTest { + + @Test + public void test() { + Queue qu = new Queue(); + qu.enQueue("gong"); + qu.enQueue("bo"); + qu.enQueue("jie"); + System.out.println(qu.size()); + qu.deQueue(); + System.out.println(qu.size()); + System.out.println(qu.isEmpty()); + qu.enQueue("gong"); + qu.enQueue("bo"); + qu.deQueue(); + qu.enQueue("jie"); + System.out.println(qu.size()); + } + +} diff --git a/group06/949319266/src/com/coding/basic/test/StackTest.java b/group06/949319266/src/com/coding/basic/test/StackTest.java new file mode 100644 index 0000000000..d76742e8ff --- /dev/null +++ b/group06/949319266/src/com/coding/basic/test/StackTest.java @@ -0,0 +1,26 @@ +package com.coding.basic.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.coding.basic.Stack; + +public class StackTest { + + @Test + public void test() { + Stack s = new Stack(); + s.push("gong"); + s.push("bo"); + s.push("jie"); + s.push("hao"); + s.push("ren"); + System.out.println(s.size()); + System.out.println(s.peek()); + s.pop(); + System.out.println(s.size()); + System.out.println(s.peek()); + } + +} diff --git "a/group06/949319266/\346\226\207\347\253\240.txt" "b/group06/949319266/\346\226\207\347\253\240.txt" new file mode 100644 index 0000000000..f00eb98185 --- /dev/null +++ "b/group06/949319266/\346\226\207\347\253\240.txt" @@ -0,0 +1 @@ +http://blog.sina.com.cn/s/blog_c20b18280102x31y.html \ No newline at end of file diff --git a/liuxin/.gitignore b/liuxin/.gitignore deleted file mode 100644 index ae3c172604..0000000000 --- a/liuxin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin/ diff --git a/liuxin/src/com/coding/basic/ArrayList.java b/liuxin/src/com/coding/basic/ArrayList.java deleted file mode 100644 index 1f185736f9..0000000000 --- a/liuxin/src/com/coding/basic/ArrayList.java +++ /dev/null @@ -1,32 +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){ - - } - 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/liuxin/src/com/coding/basic/BinaryTreeNode.java b/liuxin/src/com/coding/basic/BinaryTreeNode.java deleted file mode 100644 index d7ac820192..0000000000 --- a/liuxin/src/com/coding/basic/BinaryTreeNode.java +++ /dev/null @@ -1,32 +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/liuxin/src/com/coding/basic/Iterator.java b/liuxin/src/com/coding/basic/Iterator.java deleted file mode 100644 index 06ef6311b2..0000000000 --- a/liuxin/src/com/coding/basic/Iterator.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.coding.basic; - -public interface Iterator { - public boolean hasNext(); - public Object next(); - -} diff --git a/liuxin/src/com/coding/basic/LinkedList.java b/liuxin/src/com/coding/basic/LinkedList.java deleted file mode 100644 index e2c4e5e795..0000000000 --- a/liuxin/src/com/coding/basic/LinkedList.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.coding.basic; - -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/liuxin/src/com/coding/basic/List.java b/liuxin/src/com/coding/basic/List.java deleted file mode 100644 index 10d13b5832..0000000000 --- a/liuxin/src/com/coding/basic/List.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.coding.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/liuxin/src/com/coding/basic/Queue.java b/liuxin/src/com/coding/basic/Queue.java deleted file mode 100644 index 36e516e266..0000000000 --- a/liuxin/src/com/coding/basic/Queue.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.coding.basic; - -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/liuxin/src/com/coding/basic/Stack.java b/liuxin/src/com/coding/basic/Stack.java deleted file mode 100644 index a5a04de76d..0000000000 --- a/liuxin/src/com/coding/basic/Stack.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.coding.basic; - -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; - } -} From 40bdce249facc1ce3ea221f84068c4134479c5a2 Mon Sep 17 00:00:00 2001 From: diliuzuzhanghao <949319266@qq.com> Date: Fri, 24 Feb 2017 22:09:54 +0800 Subject: [PATCH 05/68] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=92=8C=E6=96=87?= =?UTF-8?q?=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- group06/949319266/949319266learn/.classpath | 6 ++++++ group06/949319266/949319266learn/.gitignore | 1 + group06/949319266/949319266learn/.project | 17 +++++++++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 11 +++++++++++ .../949319266/RemoteSystemsTempFiles/.project | 12 ++++++++++++ 5 files changed, 47 insertions(+) create mode 100644 group06/949319266/949319266learn/.classpath create mode 100644 group06/949319266/949319266learn/.gitignore create mode 100644 group06/949319266/949319266learn/.project create mode 100644 group06/949319266/949319266learn/.settings/org.eclipse.jdt.core.prefs create mode 100644 group06/949319266/RemoteSystemsTempFiles/.project diff --git a/group06/949319266/949319266learn/.classpath b/group06/949319266/949319266learn/.classpath new file mode 100644 index 0000000000..fceb4801b5 --- /dev/null +++ b/group06/949319266/949319266learn/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/group06/949319266/949319266learn/.gitignore b/group06/949319266/949319266learn/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/group06/949319266/949319266learn/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/group06/949319266/949319266learn/.project b/group06/949319266/949319266learn/.project new file mode 100644 index 0000000000..aa3f29e266 --- /dev/null +++ b/group06/949319266/949319266learn/.project @@ -0,0 +1,17 @@ + + + 949319266learn + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/group06/949319266/949319266learn/.settings/org.eclipse.jdt.core.prefs b/group06/949319266/949319266learn/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..3a21537071 --- /dev/null +++ b/group06/949319266/949319266learn/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/group06/949319266/RemoteSystemsTempFiles/.project b/group06/949319266/RemoteSystemsTempFiles/.project new file mode 100644 index 0000000000..5447a64fa9 --- /dev/null +++ b/group06/949319266/RemoteSystemsTempFiles/.project @@ -0,0 +1,12 @@ + + + RemoteSystemsTempFiles + + + + + + + org.eclipse.rse.ui.remoteSystemsTempNature + + From 720d25fa2ae20fa0a189082124f77df9bbe648e5 Mon Sep 17 00:00:00 2001 From: myparamita Date: Fri, 24 Feb 2017 22:53:10 +0800 Subject: [PATCH 06/68] first commit --- .gitignore | 5 + group07/43819473/homework/pom.xml | 12 ++ .../main/java/dataStructure/ArrayList.java | 87 +++++++++++++ .../src/main/java/dataStructure/Iterator.java | 9 ++ .../main/java/dataStructure/LinkedList.java | 116 ++++++++++++++++++ .../src/main/java/dataStructure/List.java | 16 +++ .../src/main/java/dataStructure/Queue.java | 25 ++++ .../src/main/java/dataStructure/Stack.java | 29 +++++ 8 files changed, 299 insertions(+) create mode 100644 group07/43819473/homework/pom.xml create mode 100644 group07/43819473/homework/src/main/java/dataStructure/ArrayList.java create mode 100644 group07/43819473/homework/src/main/java/dataStructure/Iterator.java create mode 100644 group07/43819473/homework/src/main/java/dataStructure/LinkedList.java create mode 100644 group07/43819473/homework/src/main/java/dataStructure/List.java create mode 100644 group07/43819473/homework/src/main/java/dataStructure/Queue.java create mode 100644 group07/43819473/homework/src/main/java/dataStructure/Stack.java diff --git a/.gitignore b/.gitignore index ec55baf87d..4de1b4e4c3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ hs_err_pid* #ide config .metadata .recommenders + +#add rules +*.xml +!pom.xml +*.iml \ No newline at end of file diff --git a/group07/43819473/homework/pom.xml b/group07/43819473/homework/pom.xml new file mode 100644 index 0000000000..bafc987cc6 --- /dev/null +++ b/group07/43819473/homework/pom.xml @@ -0,0 +1,12 @@ + + + 4.0.0 + + homework1 + homework + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/group07/43819473/homework/src/main/java/dataStructure/ArrayList.java b/group07/43819473/homework/src/main/java/dataStructure/ArrayList.java new file mode 100644 index 0000000000..40ccb13a06 --- /dev/null +++ b/group07/43819473/homework/src/main/java/dataStructure/ArrayList.java @@ -0,0 +1,87 @@ +package dataStructure; + +/** + * Created by zj on 2017/2/20. + */ +public class ArrayList implements List { + + private int size = 0; + + private Object[] elementData = new Object[100]; + + public void add(Object o) { + if (size > elementData.length / 2) { + elementData = grow(elementData); + } + + elementData[size] = o; + size++; + } + + private Object[] grow(Object[] datas) { + Object[] elementDataNew = new Object[elementData.length + elementData.length / 4]; + System.arraycopy(datas, 0, elementDataNew, 0, size); + return elementDataNew; + } + + public void add(int index, Object o) { + + if (index <0 || index > size - 1) { + throw new IndexOutOfBoundsException("index out of bound"); + } + + if (size > elementData.length / 2) { + elementData = grow(elementData); + } + + for (int i = size - 1; i >= index; i--) { + elementData[i + 1] = elementData[i]; + } + elementData[index] = o; + size++; + } + + public Object get(int index) { + if (index <0 || index > size - 1) { + throw new IndexOutOfBoundsException("index out of bound"); + } + return elementData[index]; + } + + public Object remove(int index) { + if (index <0 || index > size - 1) { + throw new IndexOutOfBoundsException("index out of bound"); + } + + for (int i = index; i <= size - 1; i++) { + elementData[i] = elementData[i + 1]; + } + elementData[size - 1] = null; + size--; + return null; + } + + public int size() { + return size; + } + + public Iterator iterator() { + return new ArrayListInterator(); + } + + private class ArrayListInterator implements Iterator { + + private int nowIndex = 0; + + public boolean hasNext() { + if (nowIndex <= size - 1) { + return true; + } + return false; + } + + public Object next() { + return elementData[nowIndex++]; + } + } +} diff --git a/group07/43819473/homework/src/main/java/dataStructure/Iterator.java b/group07/43819473/homework/src/main/java/dataStructure/Iterator.java new file mode 100644 index 0000000000..06ad99316f --- /dev/null +++ b/group07/43819473/homework/src/main/java/dataStructure/Iterator.java @@ -0,0 +1,9 @@ +package dataStructure; + +/** + * Created by zj on 2017/2/20. + */ +public interface Iterator { + public boolean hasNext(); + public Object next(); +} \ No newline at end of file diff --git a/group07/43819473/homework/src/main/java/dataStructure/LinkedList.java b/group07/43819473/homework/src/main/java/dataStructure/LinkedList.java new file mode 100644 index 0000000000..f6a960698a --- /dev/null +++ b/group07/43819473/homework/src/main/java/dataStructure/LinkedList.java @@ -0,0 +1,116 @@ +package dataStructure; + +/** + * Created by LvZhenxing on 2017/2/21. + */ +public class LinkedList implements List { + + private Node head=new Node(); + private int size = 0; + + public void add(Object o) { + addToNode(head,o); + size++; + } + + public void add(int index, Object o) { + if (index <0 || index > size) { + throw new IndexOutOfBoundsException("index out of bound"); + } + + addToNode(getLastNode(index),o); + size++; + } + + private Node getLastNode(int index){ + + Node nowNode = head; + for (int pos = 1; pos <= index; pos++) { + nowNode = nowNode.next; + } + return nowNode; + } + private void addToNode(Node node,Object o){ + if (node.next == null) { + Node newNode = new Node(); + newNode.data = o; + node.next = newNode; + } else { + Node newNode = new Node(); + newNode.data = o; + newNode.next = node.next; + node.next = newNode; + } + } + + public Object get(int index) { + if (index <0 || index > size - 1) { + throw new IndexOutOfBoundsException("index out of bound"); + } + + Node node= getLastNode(index); + return node.next==null?null:node.next.data; + } + + public Object remove(int index) { + if (index <0 || index > size - 1) { + throw new IndexOutOfBoundsException("index out of bound"); + } + + Node node= getLastNode(index); + Node nowNode=node.next; + if(nowNode.next!=null){ + node.next=node.next.next; + }else{ + node.next=null; + } + size--; + return nowNode.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 LinkedListInterator(); + } + + private class LinkedListInterator implements Iterator { + + private int nowIndex = 0; + + public boolean hasNext() { + if (nowIndex <= size - 1) { + return true; + } + return false; + } + + public Object next() { + return get(nowIndex++); + } + } + + + private static class Node { + Object data; + Node next; + } +} diff --git a/group07/43819473/homework/src/main/java/dataStructure/List.java b/group07/43819473/homework/src/main/java/dataStructure/List.java new file mode 100644 index 0000000000..0b1b43fc26 --- /dev/null +++ b/group07/43819473/homework/src/main/java/dataStructure/List.java @@ -0,0 +1,16 @@ +package dataStructure; + +/** + * Created by zj on 2017/2/20. + */ +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(); +} \ No newline at end of file diff --git a/group07/43819473/homework/src/main/java/dataStructure/Queue.java b/group07/43819473/homework/src/main/java/dataStructure/Queue.java new file mode 100644 index 0000000000..943e0e64f6 --- /dev/null +++ b/group07/43819473/homework/src/main/java/dataStructure/Queue.java @@ -0,0 +1,25 @@ +package dataStructure; + +/** + * Created by LvZhenxing on 2017/2/22. + */ +public class Queue { + + private LinkedList list=new LinkedList(); + + public void enQueue(Object o) { + list.addFirst(o); + } + + public Object deQueue() { + return list.removeLast(); + } + + public boolean isEmpty() { + return list.size()==0?true:false; + } + + public int size() { + return list.size(); + } +} diff --git a/group07/43819473/homework/src/main/java/dataStructure/Stack.java b/group07/43819473/homework/src/main/java/dataStructure/Stack.java new file mode 100644 index 0000000000..e1a7161317 --- /dev/null +++ b/group07/43819473/homework/src/main/java/dataStructure/Stack.java @@ -0,0 +1,29 @@ +package dataStructure; + +/** + * Created by LvZhenxing on 2017/2/22. + */ +public class Stack { + + private LinkedList list = new LinkedList(); + + public void push(Object o) { + list.addFirst(o); + } + + public Object pop() { + return list.removeFirst(); + } + + public Object peek() { + return list.get(0); + } + + public boolean isEmpty() { + return list.size() == 0 ? true : false; + } + + public int size() { + return list.size(); + } +} From 391a7638d3c3da9b33c1da4a24a8fe3f2476145d Mon Sep 17 00:00:00 2001 From: Pxshuo Date: Sat, 25 Feb 2017 02:32:33 +0800 Subject: [PATCH 07/68] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 初版 --- group06/2415980327/.gitignore | 7 + group06/2415980327/CodeSE01/.gitignore | 1 + .../src/com/pxshuo/basic/Iterator.java | 15 ++ .../CodeSE01/src/com/pxshuo/basic/List.java | 37 ++++ .../src/com/pxshuo/basic/TreeData.java | 20 ++ .../src/com/pxshuo/basic/impl/ArrayList.java | 132 +++++++++++++ .../src/com/pxshuo/basic/impl/BinaryTree.java | 19 ++ .../com/pxshuo/basic/impl/BinaryTreeNode.java | 81 ++++++++ .../src/com/pxshuo/basic/impl/LinkedList.java | 181 ++++++++++++++++++ .../src/com/pxshuo/basic/impl/Queue.java | 44 +++++ .../src/com/pxshuo/basic/impl/Stack.java | 51 +++++ .../com/pxshuo/basic/impl/package-info.java | 14 ++ .../CodeSE01/src/com/pxshuo/test/Test.java | 57 ++++++ .../com/pxshuo/basic/impl/ArrayListTest.java | 15 ++ group06/2415980327/readme.md | 18 ++ 15 files changed, 692 insertions(+) create mode 100644 group06/2415980327/.gitignore create mode 100644 group06/2415980327/CodeSE01/.gitignore create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/Iterator.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/List.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/LinkedList.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Queue.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Stack.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/package-info.java create mode 100644 group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java create mode 100644 group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java create mode 100644 group06/2415980327/readme.md diff --git a/group06/2415980327/.gitignore b/group06/2415980327/.gitignore new file mode 100644 index 0000000000..d3b69db2b2 --- /dev/null +++ b/group06/2415980327/.gitignore @@ -0,0 +1,7 @@ +/.metadata/ + +/RemoteSystemsTempFiles/ +/.recommenders/ +.settings/ +.project +.classpath diff --git a/group06/2415980327/CodeSE01/.gitignore b/group06/2415980327/CodeSE01/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/group06/2415980327/CodeSE01/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/Iterator.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/Iterator.java new file mode 100644 index 0000000000..c41df9c249 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/Iterator.java @@ -0,0 +1,15 @@ +package com.pxshuo.basic; + +public interface Iterator { + /** + * 查看是否有下一个元素 + * @return 有的话返回true,否则返回false + */ + public boolean hasNext(); + /** + * 获得下一个元素,也就是当前元素 + * @return 获取当前位置的元素 + */ + public Object next(); + +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/List.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/List.java new file mode 100644 index 0000000000..615ee9419b --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/List.java @@ -0,0 +1,37 @@ +package com.pxshuo.basic; +/** + * 数组的接口 + * @author Pxshuo + * + */ + +public interface List { + /** + * 向数组中添加一个元素 + * @param o 添加的元素 + */ + public void add(Object o); + /** + * 向数组中某一个位置添加一个元素 + * @param index 添加元素的位置 + * @param o 添加的元素 + */ + public void add(int index,Object o); + /** + * 从数组中根据位置获取一个元素 + * @param index 想要获取的元素的位置 + * @return 想获取的元素 + */ + public Object get(int index); + /** + * 根据位置移除数组中的一个元素 + * @param index 被移除元素的位置 + * @return 被移除的元素 + */ + public Object remove(int index); + /** + * 获取数组的长度 + * @return 返回数组的长度 + */ + public int size(); +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java new file mode 100644 index 0000000000..ef7901606c --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java @@ -0,0 +1,20 @@ +package com.pxshuo.basic; + +public class TreeData implements Comparable { + private int data; + + public TreeData(int data) { + this.data = data; + } + + @Override + public String toString() { + return data + ""; + } + + @Override + public int compareTo(Object o) { + return data - ((TreeData)o).data; + } + +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java new file mode 100644 index 0000000000..7590bca6f9 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java @@ -0,0 +1,132 @@ +package com.pxshuo.basic.impl; + +import com.pxshuo.basic.Iterator; +import com.pxshuo.basic.List; + +/** + * 实现一个ArrayList + * @author Pxshuo + * + */ + +public class ArrayList implements List{ + + private int size = -1;//数组的长度的下标 + private Object[] elements = new Object[10];//数组内容 + private int addSize = 10;//每次增加的长度 + + @Override + public void add(Object o) { + elements = grow(); + size++; + elements[size] = o;//size与index同一个概念 + } + + @Override + public void add(int index, Object o) { + elements = grow(); + int moveNum = size - index + 1;//本次操作需要移动的元素的个数; + size++; + if (index >= elements.length - 1) {//按照位置来看 + elements = grow(elements, index - (elements.length - 1)); + size = index;//size与index同一个概念 + } + + /** + * 整体向后移一位 + */ + if(moveNum > 0){ + System.arraycopy(elements, index, elements, index + 1, moveNum); + } +// for(int i = size - 1; i >= index; i--) +// { +// elements[i] = elements[i-1]; +// } + + elements[index] = o; + } + + @Override + public Object get(int index) { + return elements[index]; + } + + @Override + public Object remove(int index) { + Object removeEle = elements[index]; + int moveNum = size - index;//本次操作需要移动的元素的个数; + if (moveNum > 0) { + System.arraycopy(elements, index + 1, elements, index, size - index + 1); + } + elements[size] = null; + size--; + return removeEle; + } + + @Override + public int size() { + return size + 1; + } + + /** + * 设置迭代器 + * @return + */ + public Iterator iterator() { + return new ArrayListIterator(this); + } + + private class ArrayListIterator implements Iterator{ + + ArrayList arrayList = null; + int position = -1; + + public ArrayListIterator(ArrayList arrayList) { + this.arrayList = arrayList; + } + + @Override + public boolean hasNext() { + position ++; + if (position >= arrayList.size()) { + return false; + } + return true; + } + + @Override + public Object next() { + return arrayList.elements[position]; + } + + } + + /** + * 自动控制是否增加数组长度 + * @return 如果增加一条数据会造成数组溢出,则增加数组的长度,否则不进行改变。 + */ + private Object[] grow(){ + if (size() >= elements.length) { + return grow(elements, addSize); + } + else { + return elements; + } + + } + + /** + * 动态增加数组长度 + * @param src + * @param addSize + * @return + */ + private Object[] grow(Object[] src,int addSize){ + Object[] target = new Object[src.length + addSize]; + System.arraycopy(src, 0, target, 0, src.length); + return target; + + //return Arrays.copyOf(src, src.length + addSize);同理 + } + +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java new file mode 100644 index 0000000000..8aea75b019 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java @@ -0,0 +1,19 @@ +package com.pxshuo.basic.impl; + +public class BinaryTree { + BinaryTreeNode root = null; + + public void add(Comparable o){ + if (root == null) { + root = new BinaryTreeNode(); + root.setData(o); + } + else { + root.insert(o); + } + } + + public void display(){ + root.display(1); + } +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java new file mode 100644 index 0000000000..2b85095dbe --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java @@ -0,0 +1,81 @@ +package com.pxshuo.basic.impl; + +public class BinaryTreeNode { + + private Object data; + private BinaryTreeNode left; + private BinaryTreeNode right; + private int index = 0; + + public BinaryTreeNode() { + data = null; + 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 void setIndex(int index) { + this.index = index; + } + + public int getIndex() { + return index; + } + + public BinaryTreeNode insert(Comparable o){ + if(data == null){ + data = o; + return this; + } + //本节点已经存过数据 + BinaryTreeNode child = new BinaryTreeNode(); + child.setData(o); + if (o.compareTo(data) > 0) { + if (right == null) { + right = child; + } + else { + right.insert(o); + } + } + else {//小于等于的数据放在左子树中 + if (left == null) { + left = child; + } + else { + left.insert(o); + } + } + return child; + } + + public void display(int myIndex){ + + System.out.println(myIndex + ":" + data.toString()); + if (left != null) { + left.display(2 * myIndex); + } + if (right != null) { + right.display(2 * myIndex + 1); + } + } + +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/LinkedList.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/LinkedList.java new file mode 100644 index 0000000000..7711e72a86 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/LinkedList.java @@ -0,0 +1,181 @@ +package com.pxshuo.basic.impl; + +import java.time.Period; + +import com.pxshuo.basic.Iterator; +import com.pxshuo.basic.List; + +public class LinkedList implements List { + + private Node head = new Node(); + private Node tail = null; + private int size = -1;//与index的位置等同 + + //封装空表时候的增加与最后一次的删除-- + + public void add(Object o){ + Node node = new Node(o); + node.next = null; + + if (head.next == null) {//初始化 + head.next = node; + tail = node; + } + else { + tail.next = node; + tail = node; + } + size ++; + } + public void add(int index , Object o){ + if (index > size + 1) { + add(o); + } + else{ + Node prev = head; + Node current = new Node(o); + for(int i=0; i < index; i++) + { + prev = prev.next; + } + current.next = prev.next; + prev.next = current; + size ++; + } + } + public Object get(int index){ + if (index <= size) { + Node node = head; + for(int i = 0; i <= index;i++){ + node = node.next; + } + return node.data; + } + return null; + } + public Object remove(int index){ + Node remove = null; + if (index <= size) { + Node prev = head; + for(int i=0; i < index; i++) + { + prev = prev.next; + } + remove = prev.next; + prev.next = remove.next; + remove.next = null; + + if (index == size) {//设置尾部 + tail = prev; + if (size == 0) { + tail = null; + } + } + size --; + } + return remove != null ? remove.data : null; + } + + public int size(){ + return size + 1; + } + + public void addFirst(Object o){ + Node first = new Node(o); + first.next = head.next; + head.next = first; + if(tail == null) + { + tail = first; + } + size ++; + } + public void addLast(Object o){ + if(tail == null){ + add(o); + } + else { + Node last = new Node(o); + last.next = null; + tail.next = last; + tail = last; + size ++; + } + + } + public Object removeFirst(){ + Node first = head.next; + if(first != null) + { + head.next = first.next; + first.next = null; + } + else { + head.next = null; + } + if (head.next == null) {//如果链表为空 + tail = null; + } + size --; + return first!=null ? first.data : null; + } + public Object removeLast(){ + Node last = head; + for(;last.next != tail; last = last.next ){ + + } + tail = last; + last = last.next; + if(tail == head){//最后一个元素 + head.next=null; + tail = null; + }else { + tail.next = null; + } + + size --; + return last != null? last.data : null; + } + public Iterator iterator(){ + return new LinkedListIterator(this); + } + + private static class Node{ + Object data; + Node next; + + public Node() { + } + + public Node(Object data) { + this.data = data; + } + + } + + private class LinkedListIterator implements Iterator{ + LinkedList linkedList = null; + Node position = new Node(); + + public LinkedListIterator(LinkedList linkedList) { + this.linkedList = linkedList; + this.position = head; + } + + @Override + public boolean hasNext() { + position = position.next; + if (position == null) { + return false; + } + return true; + } + + @Override + public Object next() { + return position.data; + } + + } + +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Queue.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Queue.java new file mode 100644 index 0000000000..b042f1d18c --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Queue.java @@ -0,0 +1,44 @@ +package com.pxshuo.basic.impl; + +/** + * 基本数据结构-队列 + * @author Pxshuo + * + */ + +public class Queue { + + private LinkedList linkedList = new LinkedList(); + + /** + * 入队操作 + * @param o 入队的元素 + */ + public void enQueue(Object o){ + linkedList.addLast(o); + } + + /** + * 出队操作 + * @return 返回出队的元素 + */ + public Object deQueue(){ + return linkedList.removeFirst(); + } + + /** + * 判断队列是否为空 + * @return 为空返回true,否则返回false + */ + public boolean isEmpty(){ + return linkedList.size() == 0 ? true : false; + } + + /** + * 返回队列的长度 + * @return + */ + public int size(){ + return linkedList.size(); + } +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Stack.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Stack.java new file mode 100644 index 0000000000..f3f837e117 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/Stack.java @@ -0,0 +1,51 @@ +package com.pxshuo.basic.impl; + +/** + * 基本数据结构-栈 + * @author Pxshuo + * + */ + +public class Stack { + private ArrayList elementData = new ArrayList(); + + /** + * 使一个元素入栈 + * @param o 将要入栈的元素 + */ + public void push(Object o){ + elementData.add(elementData.size(), o); + } + + /** + * 使一个元素出栈 + * @return 返回出栈的元素 + */ + public Object pop(){ + return elementData.size() == 0 ? null : elementData.remove(elementData.size() - 1); + } + + /** + * 获得栈顶元素 + * @return 返回栈顶元素 + */ + public Object peek(){ + return elementData.size() == 0 ? null : elementData.get(elementData.size() - 1); + } + + /** + * 查看栈是否为空 + * @return 空的话返回true + */ + public boolean isEmpty(){ + return elementData.size() == 0 ? true : false; + } + + /** + * 查看栈中元素的个数 + * @return 返回栈中的个数 + */ + public int size(){ + return elementData.size(); + } +} diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/package-info.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/package-info.java new file mode 100644 index 0000000000..e87dca3a61 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/package-info.java @@ -0,0 +1,14 @@ +/** + * 用于实现基本数据类型,包括但不仅限于: + * ArrayList + * Stack + * LinkedList + * Queue + * Tree + * Iterator + */ +/** + * @author Pxshuo + * + */ +package com.pxshuo.basic.impl; \ No newline at end of file diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java b/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java new file mode 100644 index 0000000000..39f8dcce2e --- /dev/null +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java @@ -0,0 +1,57 @@ +package com.pxshuo.test; + + +import com.pxshuo.basic.Iterator; +import com.pxshuo.basic.TreeData; +import com.pxshuo.basic.impl.ArrayList; +import com.pxshuo.basic.impl.BinaryTree; +import com.pxshuo.basic.impl.LinkedList; +import com.pxshuo.basic.impl.Queue; +import com.pxshuo.basic.impl.Stack; + +public class Test { + public static void main(String[] args) { +// LinkedList arrayList = new LinkedList(); +// arrayList.add("hello1"); +// arrayList.add("hello2"); +// arrayList.add(9,"hello3"); +// //arrayList.add(10,"hello4"); +// arrayList.addLast("hi"); +// arrayList.addLast("hihi"); +// arrayList.addFirst("hi1"); +// arrayList.removeFirst(); +// arrayList.removeLast(); +// arrayList.add(1,"hi1"); +// arrayList.remove(1); +// //arrayList.add(0, "hi"); +// //arrayList.remove(8); +// //arrayList.remove(0); +// for (Iterator iterator = arrayList.iterator(); iterator.hasNext();) { +// System.out.println("hi"+iterator.next()); +// } + //Queue queue = new Queue(); +// Stack stack = new Stack(); +// +// for (int i = 0; i < 10; i++) { +// //queue.enQueue("test-" + i); +// stack.push("test-" + i); +// } +// for(int i =0; i< 11; i++) +// { +// System.out.println(stack.pop()); +// } +// stack.push("test-" + 233); +// System.out.println(stack.pop()); + + BinaryTree binaryTree = new BinaryTree(); + binaryTree.add(new TreeData(5)); + binaryTree.add(new TreeData(2)); + binaryTree.add(new TreeData(7)); + binaryTree.add(new TreeData(1)); + binaryTree.add(new TreeData(6)); + binaryTree.add(new TreeData(4)); + binaryTree.add(new TreeData(8)); + + binaryTree.display(); + } +} diff --git a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java new file mode 100644 index 0000000000..8c49730e47 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java @@ -0,0 +1,15 @@ +package test.com.pxshuo.basic.impl; + +import org.junit.Assert; +import org.junit.Test; + +import com.pxshuo.basic.impl.ArrayList; + +public class ArrayListTest { + @Test + public void addTest() { + ArrayList arrayList = new ArrayList(); + arrayList.add("String"); + Assert.assertEquals(arrayList.get(0), "String"); + } +} diff --git a/group06/2415980327/readme.md b/group06/2415980327/readme.md new file mode 100644 index 0000000000..566bee6595 --- /dev/null +++ b/group06/2415980327/readme.md @@ -0,0 +1,18 @@ +# 2415980327 北京-郑朔 + + + +## 一、创建GIt的忽略文档 + + + +windows下在git文件夹中按住shift+鼠标右键,在当前路径下打开命令窗口,输入: + +`type NUL > .gitignore` + +创建忽略配置文件,在其中将 + +> /.metadata/ + +存入即可。 + From 0acb01864b26275684d7fe053651fc6ef3b87605 Mon Sep 17 00:00:00 2001 From: BaymaxGithub <1280157271@qq.com> Date: Sat, 25 Feb 2017 14:53:08 +0800 Subject: [PATCH 08/68] 1280157271_FirstHomeWork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm not goog at use Github,I'm Members of the 7 group.This is my First Homework commit!!!thank you! --- .../20170224-01-ArrayList/.classpath | 6 + .../20170224-01-ArrayList/.gitignore | 1 + .../1280157271/20170224-01-ArrayList/.project | 17 +++ .../.settings/org.eclipse.jdt.core.prefs | 11 ++ .../src/firstHomework/fan/List.java | 9 ++ .../src/firstHomework/fan/myArrayList.java | 60 ++++++++ .../src/firstHomework/fan/myLinkedList.java | 129 ++++++++++++++++++ .../src/firstHomework/fan/myQueue.java | 51 +++++++ .../src/firstHomework/fan/myStack.java | 31 +++++ ...\347\232\204\345\205\263\347\263\273 .txt" | 1 + 10 files changed, 316 insertions(+) create mode 100644 group07/1280157271/20170224-01-ArrayList/.classpath create mode 100644 group07/1280157271/20170224-01-ArrayList/.gitignore create mode 100644 group07/1280157271/20170224-01-ArrayList/.project create mode 100644 group07/1280157271/20170224-01-ArrayList/.settings/org.eclipse.jdt.core.prefs create mode 100644 group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/List.java create mode 100644 group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myArrayList.java create mode 100644 group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myLinkedList.java create mode 100644 group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myQueue.java create mode 100644 group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myStack.java create mode 100644 "group07/1280157271/\347\254\254\344\270\200\346\211\271\345\215\232\345\256\242\345\234\260\345\235\200--CPU \345\206\205\345\255\230 \347\241\254\347\233\230\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273 .txt" diff --git a/group07/1280157271/20170224-01-ArrayList/.classpath b/group07/1280157271/20170224-01-ArrayList/.classpath new file mode 100644 index 0000000000..fceb4801b5 --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/group07/1280157271/20170224-01-ArrayList/.gitignore b/group07/1280157271/20170224-01-ArrayList/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/group07/1280157271/20170224-01-ArrayList/.project b/group07/1280157271/20170224-01-ArrayList/.project new file mode 100644 index 0000000000..4c0107dd15 --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/.project @@ -0,0 +1,17 @@ + + + 20170224-01-ArrayList + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/group07/1280157271/20170224-01-ArrayList/.settings/org.eclipse.jdt.core.prefs b/group07/1280157271/20170224-01-ArrayList/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..3a21537071 --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/List.java b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/List.java new file mode 100644 index 0000000000..6eb3636be5 --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/List.java @@ -0,0 +1,9 @@ +package firstHomework.fan; + +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/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myArrayList.java b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myArrayList.java new file mode 100644 index 0000000000..bd39bfca4e --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myArrayList.java @@ -0,0 +1,60 @@ +package firstHomework.fan; + +public class myArrayList implements List { + + private int size = 0; + private int initLength=10; + private Object[] elementData = new Object[initLength]; + + public void add(Object o){ + ensureCapacity(size+1); + elementData[size++] = o; + } + + public void add(int index, Object o){ + ensureCapacity(size+1); + if(index<0||index>size){ + System.out.println("indexӦ0-size֮䣡"); + }else{ + System.arraycopy(elementData, index, elementData, index+1, size-index); + elementData[index] = o; + size++; + } + } + + public Object get(int index){ + if(index<0||index>size){ + System.out.println("indexӦ0-size֮䣡"); + }else{ + return elementData[index]; + } + return null; + } + + public Object remove(int index){ + if(index<0||index>size){ + System.out.println("indexӦ0-size֮䣡"); + return null; + } + Object obj = get(index); + System.arraycopy(elementData, index+1, elementData, index, size-index-1); + size--; + return obj; + } + + public int size(){ + return this.size; + } + + + + public void ensureCapacity(int x){ + int oldCapacity = elementData.length; + if(x>oldCapacity){ + Object newEle[] = new Object[oldCapacity+initLength]; + System.arraycopy(elementData, 0, newEle, 0, size); + elementData = newEle; + } + } + +} diff --git a/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myLinkedList.java b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myLinkedList.java new file mode 100644 index 0000000000..da481e0232 --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myLinkedList.java @@ -0,0 +1,129 @@ +package firstHomework.fan; + + + +public class myLinkedList implements List { + private static class Node{//Ľڵṹ + Object data;// + Node next; //Nodeã൱ָ룬ָһڵ + + Node(Object e, Node next) { + this.data = e; + this.next = next; + } + } + + private Node head,last=null;//ֱָһһڵ + private int size; + + + public void add(Object o){//βӣ൱βڵ + creatLastNode(o); + } + public void add(int index , Object o){//indexǰ + if(index == 0){//˵λΪ0ôͷ + createFirstNode(o); + }else{//ȥҵָλ + Node indexBeforeNode = getNode(index-1);//ﷵصindexǰһڵ + Node newIndex =new Node(o,indexBeforeNode.next) ;//x½ڵ㱣indexBeforeָ + indexBeforeNode.next = newIndex; + size++; + } + } + public Object get(int index){ + return getNode(index).data;//صǽڵеݶ + } + + public Object remove(int index){ + if(index==0){//Ƴͷ + removeFirst(); + }else{//ҵָڵǰһڵ + Node removeNode = getNode(index-1); + removeNode.next = removeNode.next.next;//Ƴindex + size--; + return removeNode.next.data;//Ƴڵݶ + } + return null; + } + + public int size(){ + return this.size; + } + + public void addFirst(Object o){ + createFirstNode(o); + } + public void addLast(Object o){ + creatLastNode(o); + } + public Object removeFirst(){ + if(size>0){//бΪգһͷ + Node removeHead = head; + head = head.next; + size--; + return removeHead.data;//ͷݶ + }else{ + System.out.println("Ϊգ"); + } + return null; + } + public Object removeLast(){ + if(size>0){ + Node removeLastBefore = getNode(size-2);//ҵlastڵһڵ + Object returnObj = removeLastBefore.next.data; + removeLastBefore.next = null; + last = removeLastBefore; + size--; + return returnObj; + }else{ + System.out.println("Ϊգ"); + } + return null; + } + + /* + * ͷ + * */ + private void createFirstNode(Object e){ + Node oldHead = head; + Node newHead = new Node(e,oldHead);//ĽڵΪheadڵǰһڵ + head = newHead;//ܿղգheadҪָµͷڵ + if(head == null){//Ϊգheadlastָ½ڵ㣨ΪlastͲҸֵΪȷģ + last = newHead; + }else{//ͷѾ,½ڵΪͷ㣬ԭheadڶlastָlast + newHead.next = head; + } + size++; + } + /* + * β + * */ + private void creatLastNode(Object e){ + Node oldLast = last; + Node newLast = new Node(e,null);//µβڵһڵΪ + last = newLast;//ܿղգlastҪָµβڵ + if(head == null){//Ϊ + head = newLast; + }else{ + oldLast.next = newLast; + } + size++; + } + /* + * Ѱָ + * */ + private Node getNode(int index){ + if(index<0||index>=size){ + System.out.println("indexԽ磡"); + }else{ + Node node=head; + while(index != 0){ + node = node.next; + index--; + } + return node; + } + return null; + } + +} diff --git a/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myQueue.java b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myQueue.java new file mode 100644 index 0000000000..041da7e29b --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myQueue.java @@ -0,0 +1,51 @@ +package firstHomework.fan; + +public class myQueue { + private int iniLength = 10; + private Object[] array = new Object[iniLength]; + private int size = 0; + + public void enQueue(Object o){ + if(size>=array.length){//Ҫ + Object[] newArray = new Object[iniLength+array.length];//arrayԭټ10 + System.arraycopy(array, 0, newArray, 0, size); + array = newArray; + } + array[size++] = o; + } + + public Object deQueue(){//ƳһԪأԪǰλ + Object deQueue = array[0]; + System.arraycopy(array, 1, array, 0, size-1); + size--; + return deQueue; + + } + + public boolean isEmpty(){ + return size==0; + } + + public int size(){ + return this.size; + } + public static void main(String[] args) { + myQueue queue = new myQueue(); + queue.enQueue("A"); + queue.enQueue("B"); + queue.enQueue("C"); + + queue.enQueue("D"); + queue.enQueue("E"); + queue.enQueue("F"); + queue.enQueue("G"); + + while(!queue.isEmpty()){ + System.out.println(queue.deQueue());// + } + + } + + + +} diff --git a/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myStack.java b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myStack.java new file mode 100644 index 0000000000..623bbe787f --- /dev/null +++ b/group07/1280157271/20170224-01-ArrayList/src/firstHomework/fan/myStack.java @@ -0,0 +1,31 @@ +package firstHomework.fan; + + + +public class myStack { + private myArrayList array = new myArrayList();//myArrayListи̬ + + public void push(Object o){ //ջ + //ȲʱmyArrayListԼ + array.add(o);//¶ + } + + public Object pop(){//ջβϵԪأ Ҫɾ + Object pop = array.get(array.size()-1);//±ҪsizeС1 + array.remove(array.size()-1); + return pop; + } + + public Object peek(){//ֻǵջֵɾ + return array.get(array.size()-1); + } + public boolean isEmpty(){ + return array.size()==0; + } + public int size(){ + return array.size(); + } + + +} + diff --git "a/group07/1280157271/\347\254\254\344\270\200\346\211\271\345\215\232\345\256\242\345\234\260\345\235\200--CPU \345\206\205\345\255\230 \347\241\254\347\233\230\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273 .txt" "b/group07/1280157271/\347\254\254\344\270\200\346\211\271\345\215\232\345\256\242\345\234\260\345\235\200--CPU \345\206\205\345\255\230 \347\241\254\347\233\230\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273 .txt" new file mode 100644 index 0000000000..1e19f6adda --- /dev/null +++ "b/group07/1280157271/\347\254\254\344\270\200\346\211\271\345\215\232\345\256\242\345\234\260\345\235\200--CPU \345\206\205\345\255\230 \347\241\254\347\233\230\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273 .txt" @@ -0,0 +1 @@ +http://blog.csdn.net/stromcloud/article/details/56678442 \ No newline at end of file From c20c357134ea5ab22874ef067195d15d9c4216dc Mon Sep 17 00:00:00 2001 From: "devin.yin" Date: Sat, 25 Feb 2017 15:12:44 +0800 Subject: [PATCH 09/68] 1st commit--init with ArrayList --- group06/284999210/.classpath | 6 ++++++ group06/284999210/.gitignore | 3 +++ group06/284999210/.project | 17 +++++++++++++++++ .../com/coding/basic/container/ArrayList.java | 5 +++++ 4 files changed, 31 insertions(+) create mode 100644 group06/284999210/.classpath create mode 100644 group06/284999210/.gitignore create mode 100644 group06/284999210/.project create mode 100644 group06/284999210/src/com/coding/basic/container/ArrayList.java diff --git a/group06/284999210/.classpath b/group06/284999210/.classpath new file mode 100644 index 0000000000..fb5011632c --- /dev/null +++ b/group06/284999210/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/group06/284999210/.gitignore b/group06/284999210/.gitignore new file mode 100644 index 0000000000..f5ebe83019 --- /dev/null +++ b/group06/284999210/.gitignore @@ -0,0 +1,3 @@ +*.class +/.metadata +/bin \ No newline at end of file diff --git a/group06/284999210/.project b/group06/284999210/.project new file mode 100644 index 0000000000..c3e8c69e46 --- /dev/null +++ b/group06/284999210/.project @@ -0,0 +1,17 @@ + + + 284999210 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/group06/284999210/src/com/coding/basic/container/ArrayList.java b/group06/284999210/src/com/coding/basic/container/ArrayList.java new file mode 100644 index 0000000000..74c79d17bc --- /dev/null +++ b/group06/284999210/src/com/coding/basic/container/ArrayList.java @@ -0,0 +1,5 @@ +package com.coding.basic.container; + +public class ArrayList { + +} From f0e4040449a0fe99097534d10cb098773fe0bfa4 Mon Sep 17 00:00:00 2001 From: "devin.yin" Date: Sat, 25 Feb 2017 15:33:06 +0800 Subject: [PATCH 10/68] basic test for self implemented ArrayList --- .../com/coding/basic/container/ArrayList.java | 75 ++++++++++++++++++- .../basic/container/test/TestContainer.java | 68 +++++++++++++++++ 2 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 group06/284999210/src/com/coding/basic/container/test/TestContainer.java diff --git a/group06/284999210/src/com/coding/basic/container/ArrayList.java b/group06/284999210/src/com/coding/basic/container/ArrayList.java index 74c79d17bc..07db744bab 100644 --- a/group06/284999210/src/com/coding/basic/container/ArrayList.java +++ b/group06/284999210/src/com/coding/basic/container/ArrayList.java @@ -1,5 +1,78 @@ package com.coding.basic.container; -public class ArrayList { +public class ArrayList { + private Object[] elements; + private int size; + private int capacity; + + public ArrayList() { + elements = new Object[8]; + capacity = 8; + size = 0; + } + + public void add(T element) { + if (size == capacity) { + Object[] tempArray = new Object[capacity]; + for (int i = 0; i < size; i++) { + tempArray[i] = elements[i]; + } + elements = new Object[capacity * 2]; + for (int i = 0; i < size; i++) { + elements[i] = tempArray[i]; + } + elements[capacity] = element; + capacity = capacity * 2; + } + elements[size] = element; + size = size + 1; + } + + public void remove(int index) { + if (index >= capacity) { + throw new IndexOutOfBoundsException(); + } + + for (int i = index; i < size; i++) { + elements[i] = elements[i + 1]; + } + elements[size] = null; + size = size - 1; + } + + public void set(int index, Object element) { + if (index >= capacity) { + throw new IndexOutOfBoundsException(); + } + + elements[index] = element; + } + + @SuppressWarnings("unchecked") public T get(int index) { + if (index >= elements.length) { + throw new IndexOutOfBoundsException(); + } + + return (T) elements[index]; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("["); + for (int i = 0; i < size; i++) { + if (i != size - 1) { + sb.append(elements[i] + ", "); + } else { + sb.append(elements[i]); + } + } + sb.append("]"); + return sb.toString(); + } + + public int size() { + return size; + } } diff --git a/group06/284999210/src/com/coding/basic/container/test/TestContainer.java b/group06/284999210/src/com/coding/basic/container/test/TestContainer.java new file mode 100644 index 0000000000..058bbd250c --- /dev/null +++ b/group06/284999210/src/com/coding/basic/container/test/TestContainer.java @@ -0,0 +1,68 @@ +/** + * + */ +package com.coding.basic.container.test; + +import java.util.List; + +/** + * @author devin.yin + * + */ +public class TestContainer { + + /** + * @param args + */ + public static void main(String[] args) { + List list1 = new java.util.ArrayList(); + System.out.println(list1); + + // 4 basic operation for java.util.ArrayList--add remove change query + list1.add("0"); + list1.add("1"); + list1.add("2"); + list1.add("3"); + list1.add("4"); + list1.add("5"); + list1.add("6"); + list1.add("7"); + list1.add("8"); + list1.add("9"); + System.out.println(list1); + + list1.remove(0); + System.out.println(list1); + + list1.set(0, "set"); + System.out.println(list1); + + System.out.println(list1.get(0)); + + System.out.println("------------------------------------------------"); + + // 4 basic operation for com.coding.basic.container.ArrayList--add remove change query + com.coding.basic.container.ArrayList list2 = new com.coding.basic.container.ArrayList(); + System.out.println(list2); + list2.add("0"); + list2.add("1"); + list2.add("2"); + list2.add("3"); + list2.add("4"); + list2.add("5"); + list2.add("6"); + list2.add("7"); + list2.add("8"); + list2.add("9"); + System.out.println(list2); + + list2.remove(0); + System.out.println(list2); + + list2.set(0, "set"); + System.out.println(list2); + + System.out.println(list2.get(0)); + } + +} From 0fbde072b040f899065edf14d9fb69849bbc0a1f Mon Sep 17 00:00:00 2001 From: "devin.yin" Date: Sat, 25 Feb 2017 16:20:12 +0800 Subject: [PATCH 11/68] update ArrayList --- .../com/coding/basic/container/ArrayList.java | 157 ++++++++++++++++-- 1 file changed, 146 insertions(+), 11 deletions(-) diff --git a/group06/284999210/src/com/coding/basic/container/ArrayList.java b/group06/284999210/src/com/coding/basic/container/ArrayList.java index 07db744bab..eca9b07f4c 100644 --- a/group06/284999210/src/com/coding/basic/container/ArrayList.java +++ b/group06/284999210/src/com/coding/basic/container/ArrayList.java @@ -1,18 +1,24 @@ package com.coding.basic.container; -public class ArrayList { +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +public class ArrayList implements java.util.List{ private Object[] elements; private int size; private int capacity; + private static final int DEFAULT_CAPACITY = 8; public ArrayList() { elements = new Object[8]; - capacity = 8; size = 0; + capacity = DEFAULT_CAPACITY; } - public void add(T element) { + public boolean add(T element) { if (size == capacity) { Object[] tempArray = new Object[capacity]; for (int i = 0; i < size; i++) { @@ -27,32 +33,38 @@ public void add(T element) { } elements[size] = element; size = size + 1; + return true; } - public void remove(int index) { - if (index >= capacity) { - throw new IndexOutOfBoundsException(); - } + @SuppressWarnings("unchecked") + public T remove(int index) { + checkIndex(index); + Object o = elements[index]; for (int i = index; i < size; i++) { elements[i] = elements[i + 1]; } elements[size] = null; size = size - 1; + return (T)o; } - public void set(int index, Object element) { + private void checkIndex(int index) { if (index >= capacity) { throw new IndexOutOfBoundsException(); } + } + public T set(int index, Object element) { + checkIndex(index); + + Object o = elements[index]; elements[index] = element; + return (T)o; } @SuppressWarnings("unchecked") public T get(int index) { - if (index >= elements.length) { - throw new IndexOutOfBoundsException(); - } + checkIndex(index); return (T) elements[index]; } @@ -75,4 +87,127 @@ public String toString() { public int size() { return size; } + + @Override + public boolean isEmpty() { + return size == 0; + } + + @Override + public boolean contains(Object o) { + if (o == null) return false; + for (int i = 0; i < size; i++) { + if (elements[i].equals(o)) { + return true; + } + } + return false; + } + + @Override + public Iterator iterator() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object[] toArray() { + return elements; + } + + @Override + public T[] toArray(T[] a) { + return (T[])elements; + } + + @Override + public boolean remove(Object o) { + if (o == null) return false; + int findIndex = -1; + for (int i = 0; i < size; i++) { + if (elements[i].equals(o)) { + findIndex = i; + break; + } + } + + for (int i = findIndex; i < size - 1; i++) { + elements[i] = elements[i + 1]; + } + elements[size - 1] = null; + size--; + return false; + } + + @Override + public boolean containsAll(Collection c) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean addAll(Collection c) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeAll(Collection c) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean retainAll(Collection c) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void clear() { + elements = new Object[8]; + size = 0; + capacity = DEFAULT_CAPACITY; + } + + @Override + public void add(int index, T element) { + // TODO Auto-generated method stub + } + + @Override + public int indexOf(Object o) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int lastIndexOf(Object o) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public ListIterator listIterator() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListIterator listIterator(int index) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + // TODO Auto-generated method stub + return null; + } } From 6de3613ba5a80403e905d13b75cbcd8103861b67 Mon Sep 17 00:00:00 2001 From: Pxshuo Date: Sat, 25 Feb 2017 16:20:46 +0800 Subject: [PATCH 12/68] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/pxshuo/basic/TreeData.java | 4 + .../src/com/pxshuo/basic/impl/ArrayList.java | 6 ++ .../src/com/pxshuo/basic/impl/BinaryTree.java | 46 +++++++++++ .../com/pxshuo/basic/impl/BinaryTreeNode.java | 82 +++++++++++++------ .../CodeSE01/src/com/pxshuo/test/Test.java | 4 +- .../com/pxshuo/basic/impl/ArrayListTest.java | 33 +++++++- .../com/pxshuo/basic/impl/BinaryTreeTest.java | 26 ++++++ .../com/pxshuo/basic/impl/LinkedListTest.java | 43 ++++++++++ .../test/com/pxshuo/basic/impl/QueueTest.java | 23 ++++++ .../test/com/pxshuo/basic/impl/StackTest.java | 25 ++++++ 10 files changed, 261 insertions(+), 31 deletions(-) create mode 100644 group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/BinaryTreeTest.java create mode 100644 group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/LinkedListTest.java create mode 100644 group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/QueueTest.java create mode 100644 group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/StackTest.java diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java index ef7901606c..f20a3765f1 100644 --- a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/TreeData.java @@ -7,6 +7,10 @@ public TreeData(int data) { this.data = data; } + public int getData() { + return data; + } + @Override public String toString() { return data + ""; diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java index 7590bca6f9..68108e41a2 100644 --- a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/ArrayList.java @@ -24,6 +24,9 @@ public void add(Object o) { @Override public void add(int index, Object o) { + if (index > size + 1) { + return; + } elements = grow(); int moveNum = size - index + 1;//本次操作需要移动的元素的个数; size++; @@ -53,6 +56,9 @@ public Object get(int index) { @Override public Object remove(int index) { + if (index > size) { + return null; + } Object removeEle = elements[index]; int moveNum = size - index;//本次操作需要移动的元素的个数; if (moveNum > 0) { diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java index 8aea75b019..7ea54eae78 100644 --- a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTree.java @@ -1,8 +1,20 @@ package com.pxshuo.basic.impl; +import com.pxshuo.basic.Iterator; + +/** + * 排序二叉树 + * @author Pxshuo + * + */ + public class BinaryTree { BinaryTreeNode root = null; + /** + * 添加一个二叉树的节点 + * @param o + */ public void add(Comparable o){ if (root == null) { root = new BinaryTreeNode(); @@ -13,7 +25,41 @@ public void add(Comparable o){ } } + public Object get(int index){ + Stack findChild = childPath(index); + BinaryTreeNode child = null; + int childNum = 0; + for(;!findChild.isEmpty();){ + childNum = (int)findChild.pop(); + if (childNum != -1) { + child = child.getChild(childNum); + } + else { + child = root; + } + } + return child == null ? null : child.getData(); + } + public void display(){ root.display(1); } + + private Stack childPath(int index) { + Stack findChild = new Stack(); + + while(true){ + if (index == 1 || index <= 0) { + findChild.push(-1); + return findChild; + } + if (index%2 == 1) { + findChild.push(1); + } + else { + findChild.push(0); + } + index = index/2; + } + } } diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java index 2b85095dbe..d028dc5f48 100644 --- a/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/basic/impl/BinaryTreeNode.java @@ -13,33 +13,11 @@ public BinaryTreeNode() { 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 void setIndex(int index) { - this.index = index; - } - - public int getIndex() { - return index; - } - + /** + * 差入一个二叉树节点 + * @param o + * @return + */ public BinaryTreeNode insert(Comparable o){ if(data == null){ data = o; @@ -67,6 +45,27 @@ public BinaryTreeNode insert(Comparable o){ return child; } + /** + * 根据二叉树的位置获取孩子节点 + * @param index 0代表左孩子,1代表右孩子 + * @return + */ + public BinaryTreeNode getChild(int index){ + if(index == 0){ + return getLeft(); + } + else if(index == 1){ + return getRight(); + } + else { + return null; + } + } + + /** + * 用于打印二叉树 + * @param myIndex 在二叉树中的位置--采用完全二叉树 + */ public void display(int myIndex){ System.out.println(myIndex + ":" + data.toString()); @@ -78,4 +77,33 @@ public void display(int myIndex){ } } + /////////////////get和set函数/////////////////////////////////////// + + 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 void setIndex(int index) { + this.index = index; + } + + public int getIndex() { + return index; + } + } diff --git a/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java b/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java index 39f8dcce2e..c40ddac87d 100644 --- a/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java +++ b/group06/2415980327/CodeSE01/src/com/pxshuo/test/Test.java @@ -52,6 +52,8 @@ public static void main(String[] args) { binaryTree.add(new TreeData(4)); binaryTree.add(new TreeData(8)); - binaryTree.display(); + System.out.println(binaryTree.get(5).getClass()); + + //binaryTree.display(); } } diff --git a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java index 8c49730e47..4249574817 100644 --- a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java +++ b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/ArrayListTest.java @@ -6,10 +6,37 @@ import com.pxshuo.basic.impl.ArrayList; public class ArrayListTest { + ArrayList object = new ArrayList(); + @Test public void addTest() { - ArrayList arrayList = new ArrayList(); - arrayList.add("String"); - Assert.assertEquals(arrayList.get(0), "String"); + object.add("String"); + Assert.assertEquals("String", object.get(0)); + } + + @Test + public void addIndexTest(){ + object.add(3,"Hello"); + Assert.assertEquals("Hello", object.get(3) ); + } + + @Test + public void removeTest() { + object.add("Hello"); + object.add("Hello"); + object.add("Hello"); + object.add(3,"Hello"); + Assert.assertNotNull(object.get(3)); + object.remove(3); + Assert.assertNull(object.get(3)); + } + + @Test + public void sizeTest(){ + object.add("new"); + object.add("hi"); + object.add(1,"new"); + object.remove(2); + Assert.assertEquals(2, object.size()); } } diff --git a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/BinaryTreeTest.java b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/BinaryTreeTest.java new file mode 100644 index 0000000000..a9d67f7ba1 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/BinaryTreeTest.java @@ -0,0 +1,26 @@ +package test.com.pxshuo.basic.impl; + +import org.junit.Assert; +import org.junit.Test; + +import com.pxshuo.basic.TreeData; +import com.pxshuo.basic.impl.BinaryTree; + +public class BinaryTreeTest { + BinaryTree object = new BinaryTree(); + + @Test + public void binaryTest() { + BinaryTree binaryTree = new BinaryTree(); + binaryTree.add(new TreeData(5)); + binaryTree.add(new TreeData(2)); + binaryTree.add(new TreeData(7)); + binaryTree.add(new TreeData(1)); + binaryTree.add(new TreeData(6)); + binaryTree.add(new TreeData(4)); + binaryTree.add(new TreeData(8)); + + Assert.assertEquals("4", binaryTree.get(5).toString()); + Assert.assertEquals("8", binaryTree.get(7).toString()); + } +} diff --git a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/LinkedListTest.java b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/LinkedListTest.java new file mode 100644 index 0000000000..72fd2c49f1 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/LinkedListTest.java @@ -0,0 +1,43 @@ +package test.com.pxshuo.basic.impl; + +import org.junit.Assert; +import org.junit.Test; + +import com.pxshuo.basic.impl.ArrayList; +import com.pxshuo.basic.impl.LinkedList; + +public class LinkedListTest { + LinkedList object = new LinkedList(); + + @Test + public void addTest() { + object.add("String"); + Assert.assertEquals("String", object.get(0)); + } + + @Test + public void addIndexTest(){ + object.add(3,"Hello"); + Assert.assertEquals("Hello", object.get(0)); + } + + @Test + public void removeTest() { + object.add("Hello"); + object.add("Hello"); + object.add("Hello"); + object.add(3,"Hello"); + Assert.assertNotNull(object.get(3)); + object.remove(3); + Assert.assertNull(object.get(3)); + } + + @Test + public void sizeTest(){ + object.add("new"); + object.add("hi"); + object.add(1,"new"); + object.remove(2); + Assert.assertEquals(2, object.size()); + } +} diff --git a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/QueueTest.java b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/QueueTest.java new file mode 100644 index 0000000000..4f2b5735e4 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/QueueTest.java @@ -0,0 +1,23 @@ +package test.com.pxshuo.basic.impl; + +import org.junit.Assert; +import org.junit.Test; + +import com.pxshuo.basic.impl.Queue; + +public class QueueTest { + public Queue object = new Queue(); + + @Test + public void enQueueTest() { + Assert.assertEquals(true, object.isEmpty()); + object.enQueue("hello"); + object.enQueue("world"); + Assert.assertEquals(false, object.isEmpty()); + Assert.assertEquals(2, object.size()); + Assert.assertEquals("hello", object.deQueue()); + Assert.assertEquals("world", object.deQueue()); + Assert.assertEquals(0, object.size()); + } + +} diff --git a/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/StackTest.java b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/StackTest.java new file mode 100644 index 0000000000..df1e254595 --- /dev/null +++ b/group06/2415980327/CodeSE01/src/test/com/pxshuo/basic/impl/StackTest.java @@ -0,0 +1,25 @@ +package test.com.pxshuo.basic.impl; + +import org.junit.Assert; +import org.junit.Test; + +import com.pxshuo.basic.impl.Queue; +import com.pxshuo.basic.impl.Stack; + +public class StackTest { + public Stack object = new Stack(); + + @Test + public void enQueueTest() { + Assert.assertEquals(true, object.isEmpty()); + object.push("hello"); + object.push("world"); + Assert.assertEquals(false, object.isEmpty()); + Assert.assertEquals(2, object.size()); + Assert.assertEquals("world", object.peek()); + Assert.assertEquals("world", object.pop()); + Assert.assertEquals("hello", object.pop()); + Assert.assertEquals(0, object.size()); + } + +} From 3d5e9d6110d836685524426c09c4e773a376c5bc Mon Sep 17 00:00:00 2001 From: nelson Date: Sat, 25 Feb 2017 20:53:53 +0800 Subject: [PATCH 13/68] add JUnit --- group07/476770768/MyDataStructure/.classpath | 1 + .../src/com/coding/basic/MyArrayList.java | 2 +- .../src/com/coding/basic/MyArrayListTest.java | 69 +++++++++++++++++++ .../src/com/coding/basic/MyLinkedList.java | 25 ++++--- .../com/coding/basic/MyLinkedListTest.java | 67 ++++++++++++++++++ .../src/com/coding/basic/MyQueueTest.java | 45 ++++++++++++ .../src/com/coding/basic/MyStack.java | 2 +- .../src/com/coding/basic/MyStackTest.java | 56 +++++++++++++++ .../src/com/coding/basic/testFile.java | 15 ---- 9 files changed, 256 insertions(+), 26 deletions(-) create mode 100644 group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayListTest.java create mode 100644 group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedListTest.java create mode 100644 group07/476770768/MyDataStructure/src/com/coding/basic/MyQueueTest.java create mode 100644 group07/476770768/MyDataStructure/src/com/coding/basic/MyStackTest.java diff --git a/group07/476770768/MyDataStructure/.classpath b/group07/476770768/MyDataStructure/.classpath index 63b7e892d1..b387714202 100644 --- a/group07/476770768/MyDataStructure/.classpath +++ b/group07/476770768/MyDataStructure/.classpath @@ -2,5 +2,6 @@ + diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayList.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayList.java index f0c1b3608c..5c8c3bb858 100644 --- a/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayList.java +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayList.java @@ -89,7 +89,7 @@ public boolean isFull(){ } public void checkBounds(int index){ - if(index >= size || index < 0){ + if(index > size || index < 0){ //System.out.println("From MyArrayList: Index out of bounds"); throw new IndexOutOfBoundsException(OutOfBoundsMsg(index)); } diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayListTest.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayListTest.java new file mode 100644 index 0000000000..c7d9299934 --- /dev/null +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyArrayListTest.java @@ -0,0 +1,69 @@ +package com.coding.basic; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MyArrayListTest { + + + @Test + public void testAddObject() { + MyArrayList mal = new MyArrayList(); + assertEquals(0, mal.size()); + mal.add(new Integer(1)); + assertEquals(1, mal.size()); + } + + @Test + public void testAddIntObject() { + MyArrayList mal = new MyArrayList(); + mal.add(0, new Integer(1)); + assertEquals(1, mal.size()); + int tmp = 0; + try { + mal.add(4, new Integer(4)); + } catch (IndexOutOfBoundsException e) { + tmp = 1; + assertEquals(tmp, 1); + } + + } + + @Test + public void testGet() { + MyArrayList mal = new MyArrayList(); + mal.add(new Integer(1)); + assertEquals((Integer)mal.get(0),new Integer(1)); + int tmp = 0; + try { + mal.get(4); + } catch (IndexOutOfBoundsException e) { + tmp = 1; + assertEquals(tmp, 1); + } + } + + @Test + public void testRemove() { + MyArrayList mal = new MyArrayList(); + mal.add(new Integer(1)); + assertEquals((Integer)mal.get(0),new Integer(1)); + assertEquals(mal.size(),1); + } + + @Test + public void testSize() { + MyArrayList mal = new MyArrayList(); + assertEquals(0, mal.size()); + } + + @Test + public void testIsEmpty() { + MyArrayList mal = new MyArrayList(); + assertTrue(mal.isEmpty()); + mal.add(new Integer(1)); + assertFalse(mal.isEmpty()); + } + +} diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedList.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedList.java index 297c97a3ed..3fe3693b19 100644 --- a/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedList.java +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedList.java @@ -38,9 +38,13 @@ public void add(int index, Object o) { */ public void addFirst(Object o) { Node tmp = new Node(o); - tmp.next = head; - head.prov = tmp; - head = tmp; + if(head == null){ + head = tmp; + }else{ + tmp.next = head; + head.prov = tmp; + head = tmp; + } } /** @@ -97,7 +101,10 @@ public Object remove(int index) { public Node removeFirst() { Node tmp = head; head = head.next; - head.prov = null; + if(head != null){ + head.prov = null; + } + return tmp; } @@ -199,22 +206,22 @@ public MyIterator iterator() { private class LinkedListIterator implements MyIterator{ private MyLinkedList eleIterator; - private Node pos; + private int pos; private LinkedListIterator(MyLinkedList mll){ this.eleIterator = mll; - this.pos = eleIterator.get(0); + this.pos = 0; } @Override public boolean hasNext() { - return pos != null; + return pos <= size; } @Override public Object next() { - Node res = pos; - pos = pos.next; + Node res = eleIterator.get(pos); + pos++; return res; } diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedListTest.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedListTest.java new file mode 100644 index 0000000000..1da080a16a --- /dev/null +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyLinkedListTest.java @@ -0,0 +1,67 @@ +package com.coding.basic; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MyLinkedListTest { + + @Test + public void testAddObject() { + MyLinkedList mll = new MyLinkedList(); + assertEquals(0, mll.size()); + mll.add(new Integer(1)); + assertEquals(1, mll.size()); + } + + @Test + public void testAddIntObject() { + MyLinkedList mll = new MyLinkedList(); + mll.add(0, new Integer(1)); + assertEquals(1, mll.size()); + int tmp = 0; + try { + mll.add(4, new Integer(4)); + } catch (IndexOutOfBoundsException e) { + tmp = 1; + assertEquals(tmp, 1); + } + } + + @Test + public void testGet() { + MyLinkedList mll = new MyLinkedList(); + mll.add(new Object()); + assertNotNull(mll.get(0)); + int tmp = 0; + try { + mll.get(4); + } catch (IndexOutOfBoundsException e) { + tmp = 1; + assertEquals(tmp, 1); + } + } + + @Test + public void testRemove() { + MyLinkedList mll = new MyLinkedList(); + mll.add(new Object()); + mll.remove(0); + assertEquals(mll.size(),0); + } + + @Test + public void testSize() { + MyLinkedList mll = new MyLinkedList(); + assertEquals(0, mll.size()); + } + + @Test + public void testIsEmpty() { + MyLinkedList mll = new MyLinkedList(); + assertTrue(mll.isEmpty()); + mll.add(new Object()); + assertFalse(mll.isEmpty()); + } + +} diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyQueueTest.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyQueueTest.java new file mode 100644 index 0000000000..3d80a95ee4 --- /dev/null +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyQueueTest.java @@ -0,0 +1,45 @@ +package com.coding.basic; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MyQueueTest { + + @Test + public void testEnQueue() { + MyQueue mq = new MyQueue(); + assertEquals(mq.size(), 0); + mq.enQueue(new Object()); + assertEquals(mq.size(), 1); + } + + @Test + public void testDeQueue() { + MyQueue mq = new MyQueue(); + int tmp = 0; + try { + mq.deQueue(); + } catch (IndexOutOfBoundsException e) { + tmp = 1; + assertEquals(tmp, 1); + } + mq.enQueue(new Object()); + assertNotNull(mq.deQueue()); + } + + @Test + public void testIsEmpty() { + MyQueue mq = new MyQueue(); + assertTrue(mq.isEmpty()); + mq.enQueue(new Object()); + assertFalse(mq.isEmpty()); + } + + @Test + public void testSize() { + MyQueue mq = new MyQueue(); + assertEquals(mq.size(), 0); + } + +} diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyStack.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyStack.java index 3d9e1ef9a0..3c5b5a6b67 100644 --- a/group07/476770768/MyDataStructure/src/com/coding/basic/MyStack.java +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyStack.java @@ -31,7 +31,7 @@ public Object peek(){ } public boolean isEmpty(){ - return top >= 0; + return top < 0; } public int size(){ diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/MyStackTest.java b/group07/476770768/MyDataStructure/src/com/coding/basic/MyStackTest.java new file mode 100644 index 0000000000..0722e2d4fa --- /dev/null +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/MyStackTest.java @@ -0,0 +1,56 @@ +package com.coding.basic; + +import static org.junit.Assert.*; + +import java.util.EmptyStackException; + +import org.junit.Test; + +public class MyStackTest { + + @Test + public void testPush() { + MyStack ms = new MyStack(); + assertEquals(0, ms.size()); + ms.push(new Object()); + assertEquals(1, ms.size()); + } + + @Test + public void testPop() { + MyStack ms = new MyStack(); + ms.push(new Object()); + assertNotNull(ms.pop()); + assertEquals(0, ms.size()); + } + + @Test + public void testPeek() { + MyStack ms = new MyStack(); + int tmp = 0; + try { + ms.peek(); + } catch (EmptyStackException e) { + tmp = 1; + assertEquals(1, tmp); + } + ms.push(new Object()); + assertNotNull(ms.peek()); + assertEquals(1, ms.size()); + } + + @Test + public void testIsEmpty() { + MyStack ms = new MyStack(); + assertTrue(ms.isEmpty()); + ms.push(new Object()); + assertFalse(ms.isEmpty()); + } + + @Test + public void testSize() { + MyStack ms = new MyStack(); + assertEquals(0, ms.size()); + } + +} diff --git a/group07/476770768/MyDataStructure/src/com/coding/basic/testFile.java b/group07/476770768/MyDataStructure/src/com/coding/basic/testFile.java index 1ccabfc977..e75137744b 100644 --- a/group07/476770768/MyDataStructure/src/com/coding/basic/testFile.java +++ b/group07/476770768/MyDataStructure/src/com/coding/basic/testFile.java @@ -3,21 +3,6 @@ public class testFile { public static void main(String[] args) { - MyLinkedList mll = new MyLinkedList(); - mll.add(new Integer(5)); - mll.add(new Integer(2)); - mll.add(new Integer(3)); - mll.add(new Integer(4)); - System.out.println(mll); - MyIterator mIt = mll.iterator(); - while(mIt.hasNext()){ - System.out.println(mIt.next()); - } - mll.remove(3); - System.out.println(mll); - - - } } From 5f56c2ac21321f31fe20611878b26268359593f3 Mon Sep 17 00:00:00 2001 From: Pxshuo Date: Sat, 25 Feb 2017 21:10:03 +0800 Subject: [PATCH 14/68] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\227\264\347\232\204\345\205\263\347\263\273.md" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "group06/2415980327/\346\226\207\347\253\240/SE01_\350\256\241\347\256\227\346\234\272CPU\343\200\201\347\241\254\347\233\230\343\200\201\345\206\205\345\255\230\344\273\245\345\217\212\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" diff --git "a/group06/2415980327/\346\226\207\347\253\240/SE01_\350\256\241\347\256\227\346\234\272CPU\343\200\201\347\241\254\347\233\230\343\200\201\345\206\205\345\255\230\344\273\245\345\217\212\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" "b/group06/2415980327/\346\226\207\347\253\240/SE01_\350\256\241\347\256\227\346\234\272CPU\343\200\201\347\241\254\347\233\230\343\200\201\345\206\205\345\255\230\344\273\245\345\217\212\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" new file mode 100644 index 0000000000..ee1bdbd433 --- /dev/null +++ "b/group06/2415980327/\346\226\207\347\253\240/SE01_\350\256\241\347\256\227\346\234\272CPU\343\200\201\347\241\254\347\233\230\343\200\201\345\206\205\345\255\230\344\273\245\345\217\212\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" @@ -0,0 +1,13 @@ +# 计算机CPU、硬盘、内存以及指令之间的关系 + +by 2415980327 + +​ 但凡常见的事物,总会让人习以为常。伴随着计算机在在现代社会中的普及,人们可以日常生活中随处见到计算机在辅助我们进行各种各样的工作。在未经深究的情况下,我们就自然而然的认为,计算机本身就是这个样子。计算机实际上是什么样,我也不清楚。从小学知道这种事物开始,也是慢慢地在了解这种机器。 + +​ 就我所知,我们目前使用的常见的个人计算机在概念上是属于图灵机的。图灵机这个概念是研究将人们数学的运算过程使用机器来进行代替。它是由一个纸带作为输入与输出,同时使用一个处理器来处理这个纸带,达到运算的目的。类似是程序中函数的概念。或许来说程序中函数的概念要比图灵机的概念晚得多,但是作为一个程序员来说,就没有必要非要把自己置于一无所知的情形下再去学习这个概念。既然我已经知道了函数这个概念,那我就用函数来类比图灵机的概念吧。类似于函数的输入-处理-输出这种结构,想必大家也是一目了然的。 + +​ 图灵机只是作为一个理论上模拟出来的机器,只是为了证明这样是可行的。而实际上实现的是冯诺依曼体系结构的计算机。我们日常所见的计算机也是基于这种体系结构建立起来的。冯诺依曼体系结构是分为五部分的,包括存储器,运算器、控制器、输入设备和输出设备。同样也可以类比为函数,输入设备输出设备同图灵机一样只是作为输入与输出,剩下的存储器、控制器与运算器是做为处理器存在的,类似于函数中的变量,逻辑结构与逻辑运算的存在。存储器就是存储一些信息,运算器是做一些实际上的运算,控制器是进行程序指令的跳转,来实现各种不同的结构。 + +​ 而本文提及的CPU就是运算器与控制器的集合,内存就相当于函数中的变量,也就是相当于存储器。那硬盘是用来做什么的呢?硬盘是用作数据的持久化,一方面由于成本较低,所以是当做大量的数据存储单元。另一方面由于内存断电会清空,所以使用硬盘来存储信息更为方便。所以我认为硬盘应该是游离于这个体系之外的辅助设备。类似于程序的数据库或者程序的文本存档。 + +​ 指令与数据平时存储于硬盘之中,在需要运行程序时,将其读入到内存中来,通过CPU来处理内存中的数据。那么CPU为什么不直接处理硬盘中的数据呢?因为硬盘相比于内存的访问速度太慢了,相比于CPU的处理速度更是慢到离谱,所以才需要内存的当做存储器为CPU的处理工作提供支持。 \ No newline at end of file From e6aa67f347ee227a153841de4165e406d87ce995 Mon Sep 17 00:00:00 2001 From: Kimisme Date: Sat, 25 Feb 2017 22:05:01 +0800 Subject: [PATCH 15/68] 001DataStructure --- group07/178007127/001DataStructure/.classpath | 8 + group07/178007127/001DataStructure/.gitignore | 2 + group07/178007127/001DataStructure/.project | 18 ++ ...ource.ide.eclipse.gradle.core.import.prefs | 9 + ...springsource.ide.eclipse.gradle.core.prefs | 5 + ...ingsource.ide.eclipse.gradle.refresh.prefs | 8 + .../.settings/org.eclipse.jdt.core.prefs | 11 + group07/178007127/001DataStructure/README.md | 2 + .../178007127/001DataStructure/build.gradle | 9 + .../com/easy/util/myarraylist/ArrayList.java | 91 ++++++++ .../easy/util/mylinkedlist/LinkedList.java | 194 ++++++++++++++++++ .../java/com/easy/util/myqueue/Queue.java | 27 +++ .../java/com/easy/util/mystack/Stack.java | 29 +++ .../easy/util/myarraylist/ArrayListTest.java | 57 +++++ .../util/mylinkedlist/LinkedListTest.java | 77 +++++++ 15 files changed, 547 insertions(+) create mode 100644 group07/178007127/001DataStructure/.classpath create mode 100644 group07/178007127/001DataStructure/.gitignore create mode 100644 group07/178007127/001DataStructure/.project create mode 100644 group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs create mode 100644 group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs create mode 100644 group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs create mode 100644 group07/178007127/001DataStructure/.settings/org.eclipse.jdt.core.prefs create mode 100644 group07/178007127/001DataStructure/README.md create mode 100644 group07/178007127/001DataStructure/build.gradle create mode 100644 group07/178007127/001DataStructure/src/main/java/com/easy/util/myarraylist/ArrayList.java create mode 100644 group07/178007127/001DataStructure/src/main/java/com/easy/util/mylinkedlist/LinkedList.java create mode 100644 group07/178007127/001DataStructure/src/main/java/com/easy/util/myqueue/Queue.java create mode 100644 group07/178007127/001DataStructure/src/main/java/com/easy/util/mystack/Stack.java create mode 100644 group07/178007127/001DataStructure/src/test/java/com/easy/util/myarraylist/ArrayListTest.java create mode 100644 group07/178007127/001DataStructure/src/test/java/com/easy/util/mylinkedlist/LinkedListTest.java diff --git a/group07/178007127/001DataStructure/.classpath b/group07/178007127/001DataStructure/.classpath new file mode 100644 index 0000000000..84b630a879 --- /dev/null +++ b/group07/178007127/001DataStructure/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/group07/178007127/001DataStructure/.gitignore b/group07/178007127/001DataStructure/.gitignore new file mode 100644 index 0000000000..4a95481e61 --- /dev/null +++ b/group07/178007127/001DataStructure/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/build/ diff --git a/group07/178007127/001DataStructure/.project b/group07/178007127/001DataStructure/.project new file mode 100644 index 0000000000..430da90497 --- /dev/null +++ b/group07/178007127/001DataStructure/.project @@ -0,0 +1,18 @@ + + + 001DataStructure + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.springsource.ide.eclipse.gradle.core.nature + org.eclipse.jdt.core.javanature + + diff --git a/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs b/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs new file mode 100644 index 0000000000..67ed2b404e --- /dev/null +++ b/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs @@ -0,0 +1,9 @@ +#org.springsource.ide.eclipse.gradle.core.preferences.GradleImportPreferences +#Sat Feb 25 12:36:04 CST 2017 +addResourceFilters=true +afterTasks=afterEclipseImport; +beforeTasks=cleanEclipse;eclipse; +enableAfterTasks=true +enableBeforeTasks=true +enableDependendencyManagement=true +projects=; diff --git a/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs b/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs new file mode 100644 index 0000000000..f846d71532 --- /dev/null +++ b/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs @@ -0,0 +1,5 @@ +#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences +#Thu Feb 23 15:58:56 CST 2017 +build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=; +org.springsource.ide.eclipse.gradle.linkedresources= +org.springsource.ide.eclipse.gradle.rootprojectloc= diff --git a/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs b/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs new file mode 100644 index 0000000000..13198da612 --- /dev/null +++ b/group07/178007127/001DataStructure/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs @@ -0,0 +1,8 @@ +#org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences +#Sat Feb 25 12:36:04 CST 2017 +addResourceFilters=true +afterTasks=afterEclipseImport; +beforeTasks=cleanEclipse;eclipse; +enableAfterTasks=true +enableBeforeTasks=true +useHierarchicalNames=false diff --git a/group07/178007127/001DataStructure/.settings/org.eclipse.jdt.core.prefs b/group07/178007127/001DataStructure/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..7341ab1683 --- /dev/null +++ b/group07/178007127/001DataStructure/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +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.7 diff --git a/group07/178007127/001DataStructure/README.md b/group07/178007127/001DataStructure/README.md new file mode 100644 index 0000000000..b071403fae --- /dev/null +++ b/group07/178007127/001DataStructure/README.md @@ -0,0 +1,2 @@ +# 001DataStructure +001DataStructure diff --git a/group07/178007127/001DataStructure/build.gradle b/group07/178007127/001DataStructure/build.gradle new file mode 100644 index 0000000000..670cff0568 --- /dev/null +++ b/group07/178007127/001DataStructure/build.gradle @@ -0,0 +1,9 @@ +apply plugin:'java' + +repositories{ + mavenCentral() +} + +dependencies{ + compile group: 'junit', name: 'junit', version: '4.12' +} \ No newline at end of file diff --git a/group07/178007127/001DataStructure/src/main/java/com/easy/util/myarraylist/ArrayList.java b/group07/178007127/001DataStructure/src/main/java/com/easy/util/myarraylist/ArrayList.java new file mode 100644 index 0000000000..112b6262d2 --- /dev/null +++ b/group07/178007127/001DataStructure/src/main/java/com/easy/util/myarraylist/ArrayList.java @@ -0,0 +1,91 @@ +package com.easy.util.myarraylist; + +public class ArrayList { + + private int size = 0; + + private Object[] elementData; + + public ArrayList() { + this.elementData = new Object[] {}; + } + + public ArrayList(int initialCapacity) { + this.elementData = new Object[initialCapacity]; + } + + public void add(Object o) { + if (elementData.length <= size) { + grow(1); + elementData[size] = o; + size++; + } else { + elementData[size] = o; + size++; + } + } + + public void add(int index, Object o) { + rangeCheckForAdd(index); + grow(1); + System.arraycopy(elementData, index, elementData, index + 1, size - index); + elementData[index] = o; + size++; + } + + public Object get(int index) { + rangeCheck(index); + return elementData[index]; + } + + public Object remove(int index) { + if (index < size) { + Object removeValue = elementData[index]; + Object[] dest = new Object[size - 1]; + System.arraycopy(elementData, 0, dest, 0, index); + System.arraycopy(elementData, index + 1, dest, index, size - index - 1); + elementData = dest; + size--; + return removeValue; + } else { + return null; + } + } + + public int size() { + return this.size; + } + + private void grow(int minCapacity) { + Object[] dest = new Object[elementData.length + minCapacity]; + System.arraycopy(elementData, 0, dest, 0, elementData.length); + elementData = dest; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + for (Object object : elementData) { + sb.append(object + ","); + } + String temp = sb.toString(); + temp = temp.substring(0, temp.length() - 1); + return "[" + temp + "]"; + } + + private void rangeCheck(int index) { + if (index >= size) { + throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); + } + } + + private String outOfBoundsMsg(int index) { + return "Index:" + index + ",Size:" + size; + } + + private void rangeCheckForAdd(int index) { + if (index < 0 || index > size) { + throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); + } + } +} diff --git a/group07/178007127/001DataStructure/src/main/java/com/easy/util/mylinkedlist/LinkedList.java b/group07/178007127/001DataStructure/src/main/java/com/easy/util/mylinkedlist/LinkedList.java new file mode 100644 index 0000000000..697b0b8476 --- /dev/null +++ b/group07/178007127/001DataStructure/src/main/java/com/easy/util/mylinkedlist/LinkedList.java @@ -0,0 +1,194 @@ +package com.easy.util.mylinkedlist; + +import java.util.NoSuchElementException; + +public class LinkedList { + + private Node first; + private Node last; + int size=0; + + public LinkedList(){ + + } + + public void add(Object o){ + linkLast(o); + } + public void add(int index , Object o){ + checkPositionIndex(index); + + if(index==size){ + linkLast(o); + }else if(index==0){ + linkFirst(o); + }else { + linkBefore(index, o); + } + } + + + private void linkBefore(int index,Object o){ + Node pred=node(index-1); + Node newNode=new Node(o, node(index)); + pred.next=newNode; + size++; + } + + public Object get(int index){ + return node(index).item; + } + public boolean remove(Object o){ + Node temp=first; + if(o==null){ + for(int i=0;i0&&index<=size; + } + + private String outOfBoundsMsg(int index) { + return "Index: "+index+", Size: "+size; + } + +} diff --git a/group07/178007127/001DataStructure/src/main/java/com/easy/util/myqueue/Queue.java b/group07/178007127/001DataStructure/src/main/java/com/easy/util/myqueue/Queue.java new file mode 100644 index 0000000000..17238af545 --- /dev/null +++ b/group07/178007127/001DataStructure/src/main/java/com/easy/util/myqueue/Queue.java @@ -0,0 +1,27 @@ +package com.easy.util.myqueue; + +import com.easy.util.mylinkedlist.LinkedList; + +public class Queue { + + LinkedList linkedList; + public Queue(){ + linkedList=new LinkedList(); + } + + public void enQueue(Object o){ + linkedList.add(o); + } + + public Object deQueue(){ + return linkedList.removeFirst(); + } + + public boolean isEmpty(){ + return size()==0; + } + + public int size(){ + return linkedList.size(); + } +} diff --git a/group07/178007127/001DataStructure/src/main/java/com/easy/util/mystack/Stack.java b/group07/178007127/001DataStructure/src/main/java/com/easy/util/mystack/Stack.java new file mode 100644 index 0000000000..83bfe03b99 --- /dev/null +++ b/group07/178007127/001DataStructure/src/main/java/com/easy/util/mystack/Stack.java @@ -0,0 +1,29 @@ +package com.easy.util.mystack; + +import com.easy.util.mylinkedlist.LinkedList; + +public class Stack { + private LinkedList elementData; + + public Stack(){ + elementData=new LinkedList(); + } + + public void push(Object o){ + elementData.addLast(o); + } + + public Object pop(){ + return elementData.removeLast(); + } + + public Object peek(){ + return elementData.get(size()-1); + } + public boolean isEmpty(){ + return size()==0; + } + public int size(){ + return elementData.size(); + } +} diff --git a/group07/178007127/001DataStructure/src/test/java/com/easy/util/myarraylist/ArrayListTest.java b/group07/178007127/001DataStructure/src/test/java/com/easy/util/myarraylist/ArrayListTest.java new file mode 100644 index 0000000000..f454374090 --- /dev/null +++ b/group07/178007127/001DataStructure/src/test/java/com/easy/util/myarraylist/ArrayListTest.java @@ -0,0 +1,57 @@ +package com.easy.util.myarraylist; + +import org.junit.Assert; +import org.junit.Test; + +import com.easy.util.myarraylist.ArrayList; + +public class ArrayListTest { + + @Test + public void test_add(){ + ArrayList list=new ArrayList(); + list.add("aa"); + list.add("bb"); + Assert.assertEquals("[aa,bb]", list.toString()); + } + + @Test + public void test_add_object(){ + ArrayList list=new ArrayList(); + list.add("aa"); + list.add("bb"); + list.add(1, "aabb"); + Assert.assertEquals("[aa,aabb,bb]", list.toString()); + } + + @Test + public void test_get(){ + ArrayList list=new ArrayList(); + list.add("aa"); + list.add("bb"); + Object element =list.get(1); + Assert.assertEquals("bb", element); + } + + @Test + public void test_remove_int(){ + ArrayList list=new ArrayList(); + list.add("aa"); + list.add("bb"); + list.add(1, "aabb"); + list.remove(1); + Assert.assertEquals("[aa,bb]", list.toString()); + } + + @Test + public void test_size(){ + ArrayList list=new ArrayList(); + list.add("aa"); + list.add("bb"); + list.add(1, "aabb"); + list.remove(1); + Assert.assertEquals(2, list.size()); + } + + +} diff --git a/group07/178007127/001DataStructure/src/test/java/com/easy/util/mylinkedlist/LinkedListTest.java b/group07/178007127/001DataStructure/src/test/java/com/easy/util/mylinkedlist/LinkedListTest.java new file mode 100644 index 0000000000..816ba6d1e7 --- /dev/null +++ b/group07/178007127/001DataStructure/src/test/java/com/easy/util/mylinkedlist/LinkedListTest.java @@ -0,0 +1,77 @@ +package com.easy.util.mylinkedlist; + +import static org.junit.Assert.*; + +import java.util.ArrayList; + +import org.junit.Test; + +import com.easy.util.mylinkedlist.LinkedList; + +public class LinkedListTest { + + @Test + public void test_add_object() { + LinkedList list=new LinkedList(); + list.add("aa"); + list.add("bb"); + assertEquals("[aa,bb]", list.toString()); + } + + @Test + public void test_add_int_object() { + LinkedList list=new LinkedList(); + list.add("aa"); + list.add("bb"); + list.add(1,"aabb"); + assertEquals("[aa,aabb,bb]", list.toString()); + } + + @Test + public void testGet() { + LinkedList list=new LinkedList(); + list.add("aa"); + list.add("bb"); + list.add(1,"aabb"); + assertEquals("aa", list.get(0)); + assertEquals("aabb", list.get(1)); + assertEquals("bb", list.get(2)); + } + + @Test + public void testRemove() { + LinkedList list=new LinkedList(); + list.add("aa"); + list.add("bb"); + list.add("cc"); + boolean b = list.remove("bb"); + assertEquals(true, b); + assertEquals("[aa,cc]", list.toString()); + } + + @Test + public void testSize() { + fail("Not yet implemented"); + } + + @Test + public void testAddFirst() { + fail("Not yet implemented"); + } + + @Test + public void testAddLast() { + fail("Not yet implemented"); + } + + @Test + public void testRemoveFirst() { + fail("Not yet implemented"); + } + + @Test + public void testRemoveLast() { + fail("Not yet implemented"); + } + +} From 1b53610bf0205d183870d908450a7452e8782a01 Mon Sep 17 00:00:00 2001 From: ByrsH Date: Sat, 25 Feb 2017 22:29:29 +0800 Subject: [PATCH 16/68] commit task --- group07/752262774/.gitignore | 23 ++ .../2.26/coding/src/main/java/ArrayList.java | 114 ++++++++++ .../coding/src/main/java/BinaryTreeNode.java | 49 ++++ .../2.26/coding/src/main/java/Iterator.java | 12 + .../2.26/coding/src/main/java/LinkedList.java | 210 ++++++++++++++++++ .../2.26/coding/src/main/java/List.java | 18 ++ .../2.26/coding/src/main/java/Queue.java | 27 +++ .../2.26/coding/src/main/java/Stack.java | 39 ++++ .../2.26/coding/src/main/test/test.java | 60 +++++ .../git\345\221\275\344\273\244.txt" | 11 - 10 files changed, 552 insertions(+), 11 deletions(-) create mode 100644 group07/752262774/.gitignore create mode 100644 group07/752262774/2.26/coding/src/main/java/ArrayList.java create mode 100644 group07/752262774/2.26/coding/src/main/java/BinaryTreeNode.java create mode 100644 group07/752262774/2.26/coding/src/main/java/Iterator.java create mode 100644 group07/752262774/2.26/coding/src/main/java/LinkedList.java create mode 100644 group07/752262774/2.26/coding/src/main/java/List.java create mode 100644 group07/752262774/2.26/coding/src/main/java/Queue.java create mode 100644 group07/752262774/2.26/coding/src/main/java/Stack.java create mode 100644 group07/752262774/2.26/coding/src/main/test/test.java delete mode 100644 "group07/752262774/git\345\221\275\344\273\244.txt" diff --git a/group07/752262774/.gitignore b/group07/752262774/.gitignore new file mode 100644 index 0000000000..8d9372e204 --- /dev/null +++ b/group07/752262774/.gitignore @@ -0,0 +1,23 @@ +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +/bin/ diff --git a/group07/752262774/2.26/coding/src/main/java/ArrayList.java b/group07/752262774/2.26/coding/src/main/java/ArrayList.java new file mode 100644 index 0000000000..a7b0f43aed --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/ArrayList.java @@ -0,0 +1,114 @@ +package main.java; + +import java.util.Arrays; +import java.util.NoSuchElementException; + +/** + * Created by yrs on 2017/2/21. + */ +public class ArrayList implements List{ + + private int size = 0; + + private Object[] elementData; + + public ArrayList() { + this.elementData = new Object[10]; + } + + public ArrayList(int initialCapacity) { + if (initialCapacity > 0) { + this.elementData = new Object[initialCapacity]; + } else if (initialCapacity == 0) { + this.elementData = new Object[0]; + } else { + throw new IllegalArgumentException("Illegal Capacity: "+ + initialCapacity); + } + } + + public void add(Object o) { + judegGrow(); + elementData[size++] = o; + } + + public void add(int index, Object o) { + if(index<0 || index>size) { + throw new IndexOutOfBoundsException(); + }else if(index == size) { + add(o); + }else { + judegGrow(); + System.arraycopy(elementData, index, elementData, index + 1, + size - index); + elementData[index] = o; + size++; + } + } + + public Object get(int index) { + rangeCheck(index); + return elementData[index]; + } + + public Object remove(int index) { + rangeCheck(index); + Object o = elementData[index]; + + int move = size - 1 -index; + if(move > 0) { + System.arraycopy(elementData, index+1, elementData, index, move); + } + elementData[--size] = null; + + return o; + } + + public int size() { + return size; + } + + public Iterator iterator() { + return new ArrrayListIterator(this); + } + + private class ArrrayListIterator implements Iterator { + + ArrayList arrayList; + + int pos; + + private ArrrayListIterator(ArrayList arrayList) { + this.arrayList = arrayList; + } + + @Override + public boolean hasNext() { + return pos != arrayList.size; + } + + @Override + public Object next() { + if(pos < size) { + int i = pos; + pos++; + return elementData[i]; + }else { + throw new NoSuchElementException(); + } + } + } + + private void judegGrow() { + if(size == elementData.length) { + elementData = Arrays.copyOf(elementData, elementData.length + 1); + } + } + + private void rangeCheck(int index) { + if(index<0 || index>=size) { + throw new IndexOutOfBoundsException(); + } + } +} + \ No newline at end of file diff --git a/group07/752262774/2.26/coding/src/main/java/BinaryTreeNode.java b/group07/752262774/2.26/coding/src/main/java/BinaryTreeNode.java new file mode 100644 index 0000000000..cf8ade9193 --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/BinaryTreeNode.java @@ -0,0 +1,49 @@ +package main.java; + +/** + * Created by yrs on 2017/2/25. + */ +public class BinaryTreeNode { + + private Object data; + + private BinaryTreeNode left; + + private BinaryTreeNode right; + + public BinaryTreeNode(BinaryTreeNode left, Object o, BinaryTreeNode right) { + setData(o); + setLeft(left); + setRight(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/group07/752262774/2.26/coding/src/main/java/Iterator.java b/group07/752262774/2.26/coding/src/main/java/Iterator.java new file mode 100644 index 0000000000..74a0b35573 --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/Iterator.java @@ -0,0 +1,12 @@ +package main.java; + +/** + * Created by yrs on 2017/2/25. + */ +public interface Iterator { + + public boolean hasNext(); + + public Object next(); +} + \ No newline at end of file diff --git a/group07/752262774/2.26/coding/src/main/java/LinkedList.java b/group07/752262774/2.26/coding/src/main/java/LinkedList.java new file mode 100644 index 0000000000..4f37c1a31c --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/LinkedList.java @@ -0,0 +1,210 @@ +package main.java; + + +import java.util.NoSuchElementException; + +/** + * Created by yrs on 2017/2/23. + */ +public class LinkedList implements List{ + + private int size; + + private Node first; + + private Node last; + + public LinkedList() { + this.first = null; + this.last =null; + } + + public void add(Object o) { + Node l = this.last; + Node newNode = new Node(l, o, null); + this.last = newNode; + if(null == l) { + this.first = newNode; + }else { + l.next = newNode; + } + this.size++; + } + + public void add(int index, Object o) { + if(index<0 || index>size) { + throw new IndexOutOfBoundsException(); + }else if(index == this.size) { + this.add(o); + }else { + Node target = targetNode(index); + Node before = target.prev; + Node newNode = new Node(before, o, target); + target.prev = newNode; + if(null == before) { + this.first = newNode; + }else { + before.next = newNode; + } + this.size++; + } + } + + public Object get(int index) { + rangeCheck(index); + return targetNode(index).data; + } + + public Object remove(int index) { + rangeCheck(index); + Node target = targetNode(index); + Node before = target.prev; + Node after = target.next; + Object o = target.data; + + if(null == before) { + this.first = null; + }else { + before.next = after; + target.prev = null; + } + + if(null == after) { + this.last = before; + }else { + after.prev = before; + target.next = null; + } + target.data = null; + this.size--; + + return o; + } + + public int size() { + return this.size; + } + + public void addFirst(Object o) { + Node node = first; + Node newNode = new Node(null, o, node); + this.first = newNode; + if(null == node) { + this.last = newNode; + }else { + node.prev = newNode; + } + this.size++; + } + + public void addLast(Object o) { + add(o); + } + + public Object removeFirst() { + Node node = first; + if (node == null) + throw new NoSuchElementException(); + + first = node.next; + Object o = node.data; + if(null == node.next) { + this.last = null; + }else { + first.prev = null; + } + node.data = null; + node.next = null; + this.size--; + return o; + } + + public Object removeLast() { + Node node = last; + if (node == null) + throw new NoSuchElementException(); + + last = node.prev; + Object o = node.data; + if(null == node.prev) { + this.first = null; + }else { + last.next = null; + } + node.data = null; + node.prev = null; + this.size--; + return o; + } + + public Iterator iterator() { + return new LinkedListIterator(this); + } + + private class LinkedListIterator implements Iterator { + + LinkedList linkedList; + + int pos; + + private LinkedListIterator(LinkedList linkedList) { + this.linkedList = linkedList; + } + + @Override + public boolean hasNext() { + return pos != linkedList.size; + } + + @Override + public Object next() { + if(pos < size) { + int i = pos; + pos++; + return linkedList.get(i); + }else { + throw new NoSuchElementException(); + } + } + } + + private void rangeCheck(int index) { + if(index<0 || index>=size) { + throw new IndexOutOfBoundsException(); + } + } + + private Node targetNode(int index) { + //由index值在链表的前半部分还是后半部分,决定是从前向后,还是从后向前查找。 + Node target = new Node(); + if(index < (this.size >> 1)) { + target = this.first; + for(int i=0; iindex; i--) { + target = target.prev; + } + } + return target; + } + + private static class Node{ + Object data; + Node next; + Node prev; + + Node() { + } + + Node(Node prev, Object o, Node next) { + this.data = o; + this.next = next; + this.prev = prev; + } + } + +} + \ No newline at end of file diff --git a/group07/752262774/2.26/coding/src/main/java/List.java b/group07/752262774/2.26/coding/src/main/java/List.java new file mode 100644 index 0000000000..0f1d979332 --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/List.java @@ -0,0 +1,18 @@ +package main.java; + +/** + * Created by yrs on 2017/2/23. + */ +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/group07/752262774/2.26/coding/src/main/java/Queue.java b/group07/752262774/2.26/coding/src/main/java/Queue.java new file mode 100644 index 0000000000..59a120f51c --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/Queue.java @@ -0,0 +1,27 @@ +package main.java; + +/** + * Created by yrs on 2017/2/25. + */ +public class Queue { + + private LinkedList elementData = new LinkedList(); + + 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(); + } + +} + \ No newline at end of file diff --git a/group07/752262774/2.26/coding/src/main/java/Stack.java b/group07/752262774/2.26/coding/src/main/java/Stack.java new file mode 100644 index 0000000000..efaa2498b9 --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/java/Stack.java @@ -0,0 +1,39 @@ +package main.java; + +/** + * Created by yrs on 2017/2/25. + */ +public class Stack { + private ArrayList elementData = new ArrayList(); + + public void push(Object o) { + elementData.add(o); + } + + public Object pop() { + Object o = elementData.remove(elementData.size()-1); + return o; + } + + public Object peek() { + Object o = elementData.get(elementData.size() - 1); + return o; + } + + public boolean isEmpty() { + return elementData.size() == 0; + } + + public int size() { + return elementData.size(); + } + + public static void main(String [] args) { + Stack stack = new Stack(); + stack.push(1); + System.out.println(stack.size() + " " + stack.peek() + " " + stack.pop() + " " + stack.isEmpty()); + + } + +} + \ No newline at end of file diff --git a/group07/752262774/2.26/coding/src/main/test/test.java b/group07/752262774/2.26/coding/src/main/test/test.java new file mode 100644 index 0000000000..b32a0b6406 --- /dev/null +++ b/group07/752262774/2.26/coding/src/main/test/test.java @@ -0,0 +1,60 @@ +package main.test; + + +import javax.swing.tree.TreeNode; +import java.util.*; + +/** + * Created by yrs on 2017/2/21. + */ +public class test { + public static void main(String [] args) { + ArrayList list = new ArrayList(4); + list.add(9); + System.out.println(list); + list.add(1,3); +// list.add(2,3); //error IndexOutOfBoundsException + list.remove(1); + System.out.println(list.size()); + + Object[] target = new Object[0]; + System.out.println(target); + Object[] EMPTY_ELEMENTDATA = {}; + System.out.println(EMPTY_ELEMENTDATA); + + + //LinkedList + LinkedList linkedList = new LinkedList(); + linkedList.add(1); + System.out.println(linkedList.get(0)); + linkedList.add(1,3); + System.out.println(linkedList.size()); + System.out.println(3 >> 1); + + for(int i=0; i<1; i++) { + System.out.println("dd"); + } + + Stack stack = new Stack(); + + Queue queue; + TreeNode treeNode; + + List lstint = new ArrayList(); + lstint.add(1); + lstint.add(2); + lstint.add(3); + + // Iterator遍历一 + Iterator iterator = lstint.iterator(); + iterator.hasNext(); + while (iterator.hasNext()) + { + int i = (Integer) iterator.next(); + System.out.println(i); + } + + + } +} + \ No newline at end of file diff --git "a/group07/752262774/git\345\221\275\344\273\244.txt" "b/group07/752262774/git\345\221\275\344\273\244.txt" deleted file mode 100644 index 8bcf2ffa0f..0000000000 --- "a/group07/752262774/git\345\221\275\344\273\244.txt" +++ /dev/null @@ -1,11 +0,0 @@ -װgit guigit bash -1.¡ -git clone git@github.com:leijing1992/coding2017.git -2.޸ĵļ -git add -A -3.ύݴ -git commit -m "ύ***" -4.master -git pull origin master -5.ύmaster -git push origin master \ No newline at end of file From 5671ee360ad71f9481350757d9f95dbb9e45c17a Mon Sep 17 00:00:00 2001 From: xiaozhupig Date: Sat, 25 Feb 2017 23:42:39 +0800 Subject: [PATCH 17/68] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E5=91=A8=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文章地址:http://blog.csdn.net/codingxiaozhupig/article/details/57150919 --- .../src/com/firsthomework/MyArrayList.java | 107 +++++++++++++++++ .../src/com/firsthomework/MyLinkedList.java | 109 ++++++++++++++++++ .../src/com/firsthomework/MyQueue.java | 52 +++++++++ .../src/com/firsthomework/MyStack.java | 62 ++++++++++ 4 files changed, 330 insertions(+) create mode 100644 group06/799237637/src/com/firsthomework/MyArrayList.java create mode 100644 group06/799237637/src/com/firsthomework/MyLinkedList.java create mode 100644 group06/799237637/src/com/firsthomework/MyQueue.java create mode 100644 group06/799237637/src/com/firsthomework/MyStack.java diff --git a/group06/799237637/src/com/firsthomework/MyArrayList.java b/group06/799237637/src/com/firsthomework/MyArrayList.java new file mode 100644 index 0000000000..cf1a3e04a2 --- /dev/null +++ b/group06/799237637/src/com/firsthomework/MyArrayList.java @@ -0,0 +1,107 @@ +/* + * óΪԼʵArrayList + * ArrayListײΪʵ֣Ƕ̬ + */ +package com.firsthomework; + + +public class MyArrayList { + private int size=0; + private int initialcapcity=10; + private Object[] elements= null; + public MyArrayList(){ + this.elements=new Object[initialcapcity]; + } + + public MyArrayList(int capcity){ + + this.elements = new Object[capcity]; + + } + public void enlarge(){ + initialcapcity*=2; + Object[] tmpelements= new Object[initialcapcity]; + System.arraycopy(elements, 0, tmpelements, 0,size); + elements=tmpelements; + } + public void add(Object o){ + if(o==null){ + throw new RuntimeException("Ϊգ"); + } + if(size>initialcapcity){ + enlarge(); + } + elements[size]=o; + size++; + + } + public Object get(int index){ + if(index<0||index>size-1){ + throw new IndexOutOfBoundsException("Խ磺"); + } + return elements[index]; + + } +//ʵremove()ɾλãԪҪǰƣɾλõԪ + public Object remove(int index){ + Object oldValue=elements[index]; + int eleMoved=size-index-1; //ƶԪصĸ + if(eleMoved>0){ + System.arraycopy(elements, //ԭ + index+1, //ԭʼλãɾԪصĺһλã + elements, //Ŀ + index, //Ŀʼλ + eleMoved);//ij + } + elements[size-1]=null; + size--; + + return oldValue; + } + + public boolean set(int index,Object o){ + if(index<0||index>size-1){ + throw new IndexOutOfBoundsException("Խ"); + } + elements[index]=o; + return true; + } + + //дtoString() + public String toString(){ + StringBuffer sb=new StringBuffer(); + sb.append("["); + for(int i=0;i Date: Sun, 26 Feb 2017 01:29:57 +0800 Subject: [PATCH 18/68] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=98=9F=E5=88=97=20?= =?UTF-8?q?=E6=A0=88=20=E5=92=8C=20ArrayList?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/coding2017.iml | 25 + .idea/compiler.xml | 22 + .idea/copyright/profiles_settings.xml | 3 + .idea/encodings.xml | 8 + .idea/inspectionProfiles/Project_Default.xml | 36 + .../inspectionProfiles/profiles_settings.xml | 7 + .idea/misc.xml | 17 + .idea/modules.xml | 8 + .idea/uiDesigner.xml | 124 ++ .idea/vcs.xml | 6 + .idea/workspace.xml | 1617 +++++++++++++++++ .../20409287/git\345\221\275\344\273\244.txt" | 14 +- .../java/xdx/homework/first/ArrayList.java | 214 +++ .../main/java/xdx/homework/first/Hello.java | 15 + .../java/xdx/homework/first/Iterator.java | 11 + .../java/xdx/homework/first/LinkedList.java | 9 + .../main/java/xdx/homework/first/List.java | 86 + .../main/java/xdx/homework/first/Queue.java | 97 + .../xdx/homework/first/SortBinaryTree.java | 7 + .../main/java/xdx/homework/first/Stack.java | 81 + .../xdx/homework/first/ArrayListTest.java | 177 ++ .../test/xdx/homework/first/QueueTest.java | 141 ++ .../test/xdx/homework/first/StackTest.java | 126 ++ 23 files changed, 2844 insertions(+), 7 deletions(-) create mode 100644 .idea/coding2017.iml create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 group07/20409287/src/main/java/xdx/homework/first/ArrayList.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/Hello.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/Iterator.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/LinkedList.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/List.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/Queue.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/SortBinaryTree.java create mode 100644 group07/20409287/src/main/java/xdx/homework/first/Stack.java create mode 100644 group07/20409287/src/test/xdx/homework/first/ArrayListTest.java create mode 100644 group07/20409287/src/test/xdx/homework/first/QueueTest.java create mode 100644 group07/20409287/src/test/xdx/homework/first/StackTest.java diff --git a/.idea/coding2017.iml b/.idea/coding2017.iml new file mode 100644 index 0000000000..459d465d9a --- /dev/null +++ b/.idea/coding2017.iml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000000..96cc43efa6 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000000..e7bedf3377 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000..f4b0ad32b0 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000..f4be559210 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000..3b312839bf --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..3eb9c7edaa --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..4bb52afa53 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000000..e96534fb27 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..35eb1ddfbb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..2be72671b0 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,1617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1488025326268 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No facets are configured + + + + + + + + + + + + + + + 1.8 + + + + + + + + coding2017 + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/group07/20409287/git\345\221\275\344\273\244.txt" "b/group07/20409287/git\345\221\275\344\273\244.txt" index 8bcf2ffa0f..bd0bffaaef 100644 --- "a/group07/20409287/git\345\221\275\344\273\244.txt" +++ "b/group07/20409287/git\345\221\275\344\273\244.txt" @@ -1,11 +1,11 @@ -װgit guigit bash -1.¡ +安装git gui软件,打开git bash操作 +1.克隆 git clone git@github.com:leijing1992/coding2017.git -2.޸ĵļ +2.添加修改的文件 git add -A -3.ύݴ -git commit -m "ύ***" -4.master +3.提交到暂存区 +git commit -m "提交***代码" +4.更新master git pull origin master -5.ύmaster +5.提交到master git push origin master \ No newline at end of file diff --git a/group07/20409287/src/main/java/xdx/homework/first/ArrayList.java b/group07/20409287/src/main/java/xdx/homework/first/ArrayList.java new file mode 100644 index 0000000000..b7ffc73d07 --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/ArrayList.java @@ -0,0 +1,214 @@ +package xdx.homework.first; + + +public class ArrayList implements List { + + private Object[] elements; + + // 列表长度,默认10个元素 + private int size = 10; + + // 最后一个元素的位置 + private int position = -1; + + public ArrayList() { + elements = new Object[size]; + } + + public ArrayList(final int capacity) { + if (capacity <= 0) + throw new RuntimeException("列表长度不可小于等于0!"); + elements = new Object[capacity]; + } + + /** + * 添加元素 + * + * @param e 要添加的元素 + * @return + */ + @Override + public boolean add(E e) { + + if (++position > size - 1) { + grow(); + } else { + elements[position] = e; + } + return true; + } + + /** + * 删除指定索引的元素 + * + * @param index 索引下标 + * @return + */ + @Override + @SuppressWarnings("unchecked") + public E remove(int index) { + + if (index < 0 || index > position || this.isEmpty()) + throw new IndexOutOfBoundsException("要删除的索引不正确!"); + + E returnElement = (E) elements[index]; + elements[index] = null; + System.arraycopy(elements, index + 1, elements, index, position + 1 - index); + position--; + return returnElement; + } + + /** + * 删除指定的元素 + * + * @param e + * @return + */ + @Override + public boolean remove(E e) { + + if (!this.contains(e)) return false; + int removeIndex = 0; + for(int i = 0; i < this.position; i++) { + if(elements[i].equals(e)) { + removeIndex = i; + break; + } + } + remove(removeIndex); + return true; + } + + /** + * 返回列表长度 + * + * @return + */ + @Override + public int size() { + return position + 1; + } + + /** + * 判断列表是否为空 + * + * @return + */ + @Override + public boolean isEmpty() { + return position == -1; + } + + /** + * 获取指定索引的元素 + * + * @param index + * @return + */ + @Override + @SuppressWarnings("unchecked") + public E get(int index) { + if (index > position) return null; + return (E)elements[index]; + } + + /** + * 重置某个索引的元素 + * + * @param index + * @param o + * @return + */ + @Override + public boolean set(int index, Object o) { + if (index > position) return false; + elements[index] = null; + elements[index] = o; + return true; + } + + /** + * 判断是否包含某个元素 + * + * @param o + * @return + */ + @Override + public boolean contains(Object o) { + + if(this.isEmpty()) return false; + for(int i = 0; i <= position; i++) { + if (elements[i].equals(o)) + return true; + } + return false; + } + + /** + * 清空列表 + */ + @Override + public void clear() { + for(int i = 0; i <= this.size(); i++) { + elements[i] = null; + } + position = -1; + } + + /** + * 取得迭代器 + * + * @return + */ + @Override + public Iterator iterator() { + return new Itr(); + } + + /** + * 数组增长 + */ + private void grow() { + Object[] newElements = new Object[size << 2]; + System.arraycopy(elements, 0, elements, 0, this.size); + elements = null; + elements = newElements; + } + + private class Itr implements Iterator { + + private int itrIndex = 0; + + @Override + public boolean hasNext() { + return get(itrIndex) != null; + } + + @Override + @SuppressWarnings("unchecked") + public E next() { + return (E) elements[itrIndex++]; + } + + @Override + public void remove() { + ArrayList.this.remove(itrIndex); + } + } + + @Override + public String toString() { + + if(this.isEmpty()) { + return "[]"; + } + StringBuilder strList = new StringBuilder("["); + for(int i = 0; i < this.size(); i++) { + strList.append(elements[i].toString()).append(","); + } + strList.deleteCharAt(strList.length() - 1); + strList.append("]"); + return strList.toString(); + } + +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/Hello.java b/group07/20409287/src/main/java/xdx/homework/first/Hello.java new file mode 100644 index 0000000000..1abb23045e --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/Hello.java @@ -0,0 +1,15 @@ +package xdx.homework.first; + +import java.util.List; + +/** + * @Description: Hello World! + * @author: xdx + * @date: 2017年2月25日 上午11:37:58 + */ +public class Hello { + + public static void main(String[] args) { + System.out.println("Hello WOrl"); + } +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/Iterator.java b/group07/20409287/src/main/java/xdx/homework/first/Iterator.java new file mode 100644 index 0000000000..b90db66d5d --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/Iterator.java @@ -0,0 +1,11 @@ +package xdx.homework.first; + + +public interface Iterator { + + boolean hasNext(); + + E next(); + + void remove(); +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/LinkedList.java b/group07/20409287/src/main/java/xdx/homework/first/LinkedList.java new file mode 100644 index 0000000000..b541b2069a --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/LinkedList.java @@ -0,0 +1,9 @@ +package xdx.homework.first; + +/** + * @Description: + * @author: {User} + * @date: {Date} + */ +public class LinkedList { +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/List.java b/group07/20409287/src/main/java/xdx/homework/first/List.java new file mode 100644 index 0000000000..7c6f1c4e52 --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/List.java @@ -0,0 +1,86 @@ +package xdx.homework.first; + +/** + * @param + * @Description: 定义一组操作有序列表的接口 + * @author: xdx + * @date: 2017年2月21日 下午8:53:52 + */ +public interface List { + + /** + * 添加元素 + * + * @param e + * @return + */ + boolean add(E e); + + /** + * 删除指定索引的元素 + * + * @param int 索引下标 + * @return + */ + E remove(int index); + + /** + * 删除指定的元素 + * + * @param e + * @return + */ + boolean remove(E e); + + /** + * 返回列表长度 + * + * @return + */ + int size(); + + /** + * 判断列表是否为空 + * + * @return + */ + boolean isEmpty(); + + /** + * 获取指定索引的元素 + * + * @param index + * @return + */ + E get(int index); + + /** + * 重置某个索引的元素 + * + * @param index + * @param e + * @return + */ + boolean set(int index, E e); + + /** + * 判断是否包含某个元素 + * + * @param e + * @return + */ + boolean contains(E e); + + /** + * 清空列表 + */ + void clear(); + + /** + * 取得迭代器 + * + * @return + */ + Iterator iterator(); + +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/Queue.java b/group07/20409287/src/main/java/xdx/homework/first/Queue.java new file mode 100644 index 0000000000..5d98cff312 --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/Queue.java @@ -0,0 +1,97 @@ +package xdx.homework.first; + +/** + * @Description: 链式队列 + */ +public class Queue { + + private class Node { + + private E data; // 数据域 + + private Node next; // 指针域 + + public Node() { + } + + private Node(E data) { + this.data = data; + this.next = null; + } + + } + + private Node front; // 队头 + + private Node rear; // 队尾 + + private int length; // 队长 + + public void enQueue(E data) { + + if(this.front == null) { + this.front = new Node(data); + this.rear = this.front; + } else { + Node newNode = new Node(data); + this.rear.next = newNode; + this.rear = newNode; + } + length++; + } + + public E deQueue() { + + if (isEmpty()) { + return null; + } + Node oldFront = this.front; + this.front = this.front.next; + length--; + return oldFront.data; + } + + public int length() { + return length; + } + + public boolean isEmpty() { + return this.front == this.rear; + } + + public void clear() { + this.length = 0; + this.front = null; + this.rear = null; + } + + public E getFront() { + + if (this.isEmpty()) { + return null; + } + return this.front.data; + } + + public E getRear() { + + if(this.isEmpty()) return null; + return this.rear.data; + } + + public String toString() { + + if (this.length == 0) return "[]"; + + Node node = this.front; + StringBuilder queueToString = new StringBuilder("["); + while (node.next != null) { + queueToString.append(node.data.toString()).append(","); + node = node.next; + } + queueToString.append(node.data.toString()).append("]"); + return queueToString.toString(); + } + + +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/SortBinaryTree.java b/group07/20409287/src/main/java/xdx/homework/first/SortBinaryTree.java new file mode 100644 index 0000000000..b48d0cf6a5 --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/SortBinaryTree.java @@ -0,0 +1,7 @@ +package xdx.homework.first; + +/** + * @Description: 顺序存储的二叉树实现 + */ +public class SortBinaryTree { +} diff --git a/group07/20409287/src/main/java/xdx/homework/first/Stack.java b/group07/20409287/src/main/java/xdx/homework/first/Stack.java new file mode 100644 index 0000000000..d898ffeb6e --- /dev/null +++ b/group07/20409287/src/main/java/xdx/homework/first/Stack.java @@ -0,0 +1,81 @@ +package xdx.homework.first; + +/** + * @Description: + * @author: {User} + * @date: {Date} + */ +public class Stack { + + private class Node { + + private E data; // 数据域 + + private Node next; // 指针域 + + public Node() { + } + + private Node(E data) { + this.data = data; + this.next = null; + } + } + + private int size; + + private Node top; + + public void push(E e) { + if(!isEmpty()) { + Node newNode = new Node(e); + newNode.next = top; + top = newNode; + } else { + top = new Node(e); + } + size++; + } + + public E pop() { + if(isEmpty()) throw new RuntimeException("空栈!"); + Node popNode = top; + top = top.next; + return popNode.data; + } + + public boolean isEmpty() { + return size == 0; + } + + public E peek() { + if(isEmpty()) throw new RuntimeException("空栈!"); + return top.data; + } + + public int size() { + return size; + } + + public void clear() { + top = null; + size = 0; + } + + @Override + public String toString() { + + if(isEmpty()) return "[]"; + StringBuilder stackToString = new StringBuilder("["); + Node itr = this.top; + while(itr != null) { + stackToString.append(itr.data.toString()).append(","); + itr = itr.next; + } + stackToString.deleteCharAt(stackToString.length() - 1).append("]"); + + return stackToString.toString(); + } + + +} diff --git a/group07/20409287/src/test/xdx/homework/first/ArrayListTest.java b/group07/20409287/src/test/xdx/homework/first/ArrayListTest.java new file mode 100644 index 0000000000..2c71401873 --- /dev/null +++ b/group07/20409287/src/test/xdx/homework/first/ArrayListTest.java @@ -0,0 +1,177 @@ +package xdx.homework.first; + + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * ArrayList Tester. + * + * @author xdx + * @version 1.0 + * @since
2月25日, 2017
+ */ +public class ArrayListTest { + + private List defaultTestList; + + @Before + public void before() throws Exception { + + defaultTestList = new ArrayList<>(); + Assert.assertTrue(defaultTestList.add("《三国演义》")); + Assert.assertTrue(defaultTestList.add("《红楼梦》")); + Assert.assertTrue(defaultTestList.add("《西游记》")); + Assert.assertTrue(defaultTestList.add("《水浒传》")); + } + + @After + public void after() throws Exception { + } + + /** + * Method: add(E e) + */ + @Test + public void testAdd() throws Exception { + + List testList = new ArrayList<>(); + Assert.assertTrue(testList.add(1)); + Assert.assertTrue(testList.add(2)); + Assert.assertTrue(testList.add(3)); + System.out.println(testList.toString()); + } + + /** + * Method: remove(int index) + */ + @Test + public void testRemoveIndex() throws Exception { + + List testReomoveList = new ArrayList<>(); + Assert.assertTrue(testReomoveList.add(4)); + Assert.assertTrue(testReomoveList.add(5)); + Assert.assertTrue(testReomoveList.add(6)); + System.out.println("删除前: " + testReomoveList); + Integer delElement = testReomoveList.get(0); + Assert.assertTrue(testReomoveList.remove(0).equals(delElement)); + System.out.println("删除后: " + testReomoveList); + } + + /** + * Method: remove(E e) + */ + @Test + public void testRemoveE() throws Exception { + + List testReomoveList = new ArrayList<>(); + Assert.assertTrue(testReomoveList.add(7)); + Assert.assertTrue(testReomoveList.add(8)); + Assert.assertTrue(testReomoveList.add(9)); + System.out.println("删除前: " + testReomoveList); + Assert.assertTrue(testReomoveList.remove(new Integer(8))); + System.out.println("删除后: " + testReomoveList); + } + + /** + * Method: size() + */ + @Test + public void testSize() throws Exception { + int size = defaultTestList.size(); + Assert.assertEquals(4, size); + System.out.println("defaultTest内容:" + defaultTestList); + System.out.println("defaultTest长度:" + size); + } + + /** + * Method: isEmpty() + */ + @Test + public void testIsEmpty() throws Exception { + Assert.assertFalse(defaultTestList.isEmpty()); + List testReomoveList = new ArrayList<>(); + Assert.assertTrue(testReomoveList.isEmpty()); + } + + /** + * Method: get(int index) + */ + @Test + public void testGet() throws Exception { + Assert.assertTrue("《三国演义》".equals(defaultTestList.get(0))); + Assert.assertFalse("《西游记》".equals(defaultTestList.get(0))); + } + + /** + * Method: set(int index, Object o) + */ + @Test + public void testSet() throws Exception { + + List testList = new ArrayList<>(); + Assert.assertTrue(testList.add(7)); + Assert.assertTrue(testList.add(8)); + Assert.assertTrue(testList.add(9)); + System.out.println("设置前: " + testList); + Assert.assertTrue(testList.set(0, 10)); + System.out.println("设置后: " + testList); + } + + /** + * Method: contains(Object o) + */ + @Test + public void testContains() throws Exception { + Assert.assertTrue(defaultTestList.contains("《红楼梦》")); + Assert.assertFalse(defaultTestList.contains("《聊斋》")); + } + + /** + * Method: clear() + */ + @Test + public void testClear() throws Exception { + + List testList = new ArrayList<>(); + Assert.assertTrue(testList.add(7)); + Assert.assertTrue(testList.add(8)); + Assert.assertTrue(testList.add(9)); + System.out.println("清除前: " + testList); + testList.clear(); + Assert.assertTrue(testList.isEmpty()); + System.out.println("清除后: " + testList); + } + + /** + * Method: iterator() + */ + @Test + public void testIterator() throws Exception { + + List testList = new ArrayList<>(); + Assert.assertTrue(testList.add(7)); + Assert.assertTrue(testList.add(8)); + Assert.assertTrue(testList.add(9)); + Iterator iterator = testList.iterator(); + Assert.assertNotNull(iterator); + while(iterator.hasNext()) { + System.out.println(iterator.next()); + } + List testListByDel = new ArrayList<>(); + Assert.assertTrue(testListByDel.add("张三")); + Assert.assertTrue(testListByDel.add("李四")); + Assert.assertTrue(testListByDel.add("王五")); + Iterator iteratorByDel = testListByDel.iterator(); + while(iteratorByDel.hasNext()) { + iteratorByDel.remove(); + } + Assert.assertTrue(testListByDel.isEmpty()); + + } + + + +} diff --git a/group07/20409287/src/test/xdx/homework/first/QueueTest.java b/group07/20409287/src/test/xdx/homework/first/QueueTest.java new file mode 100644 index 0000000000..6e56e3b8b1 --- /dev/null +++ b/group07/20409287/src/test/xdx/homework/first/QueueTest.java @@ -0,0 +1,141 @@ +package xdx.homework.first; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.Before; +import org.junit.After; +import xdx.homework.first.Queue; + +/** + * Queue Tester. + * + * @author + * @since
二月 25, 2017
+ * @version 1.0 + */ +public class QueueTest { + + private Queue defaultQueue; + + @Before + public void before() throws Exception { + + defaultQueue = new Queue<>(); + defaultQueue.enQueue("赵"); + defaultQueue.enQueue("钱"); + defaultQueue.enQueue("孙"); + defaultQueue.enQueue("李"); + defaultQueue.enQueue("周"); + defaultQueue.enQueue("吴"); + defaultQueue.enQueue("郑"); + defaultQueue.enQueue("王"); + } + + @After + public void after() throws Exception { + } + + /** + * + * Method: enQueue(E data) + * + */ + @Test + public void testEnQueue() throws Exception { + + Queue testQueue = new Queue<>(); + testQueue.enQueue("刘备"); + testQueue.enQueue("关羽"); + testQueue.enQueue("张飞"); + System.out.println(testQueue); + } + + /** + * + * Method: deQueue() + * + */ + @Test + public void testDeQueue() throws Exception { + + Queue testQueue = new Queue<>(); + testQueue.enQueue("刘备"); + testQueue.enQueue("关羽"); + testQueue.enQueue("张飞"); + System.out.println("删除前:" + testQueue); + System.out.println("删除:" + testQueue.deQueue()); + System.out.println("删除后:" + testQueue); + } + + /** + * + * Method: length() + * + */ + @Test + public void testLength() throws Exception { + Assert.assertEquals(8, defaultQueue.length()); + System.out.println("defaultQueue长度:" + defaultQueue.length()); + } + + /** + * + * Method: isEmpty() + * + */ + @Test + public void testIsEmpty() throws Exception { + Assert.assertTrue(!defaultQueue.isEmpty()); + } + + /** + * + * Method: clear() + * + */ + @Test + public void testClear() throws Exception { + + Queue testQueue = new Queue<>(); + testQueue.enQueue("刘备"); + testQueue.enQueue("关羽"); + testQueue.enQueue("张飞"); + + testQueue.clear(); + Assert.assertTrue(testQueue.isEmpty()); + } + + /** + * + * Method: getFront() + * + */ + @Test + public void testGetFront() throws Exception { + Assert.assertEquals("赵", defaultQueue.getFront()); + Assert.assertNotEquals("钱", defaultQueue.getFront()); + } + + /** + * + * Method: getRear() + * + */ + @Test + public void testGetRear() throws Exception { + Assert.assertEquals("王", defaultQueue.getRear()); + Assert.assertNotEquals("钱", defaultQueue.getFront()); + } + + /** + * + * Method: toString() + * + */ + @Test + public void testToString() throws Exception { + System.out.println("defaultQueue内容:" + defaultQueue.toString()); + } + + +} diff --git a/group07/20409287/src/test/xdx/homework/first/StackTest.java b/group07/20409287/src/test/xdx/homework/first/StackTest.java new file mode 100644 index 0000000000..bfc6b2c8f7 --- /dev/null +++ b/group07/20409287/src/test/xdx/homework/first/StackTest.java @@ -0,0 +1,126 @@ +package test.xdx.homework.first; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.Before; +import org.junit.After; +import xdx.homework.first.Stack; + +/** + * Stack Tester. + * + * @version 1.0 + */ +public class StackTest { + + private Stack defaultStack; + + @Before + public void before() throws Exception { + + defaultStack = new Stack<>(); + defaultStack.push("孙悟空"); + defaultStack.push("唐僧"); + defaultStack.push("猪八戒"); + defaultStack.push("沙僧"); + } + + @After + public void after() throws Exception { + } + + /** + * + * Method: push(E e) + * + */ + @Test + public void testPush() throws Exception { + + Stack testStack = new Stack<>(); + testStack.push("java"); + testStack.push("C++"); + testStack.push("python"); + System.out.println(testStack); + } + + /** + * + * Method: pop() + * + */ + @Test + public void testPop() throws Exception { + + Stack testStack = new Stack<>(); + testStack.push("java"); + testStack.push("C++"); + testStack.push("python"); + System.out.println(testStack); + Assert.assertEquals("python", testStack.pop()); + Assert.assertEquals("C++", testStack.pop()); + Assert.assertEquals("java", testStack.pop()); + + } + + /** + * + * Method: isEmpty() + * + */ + @Test + public void testIsEmpty() throws Exception { + + Stack testStack = new Stack<>(); + testStack.push("java"); + testStack.push("C++"); + testStack.push("python"); + System.out.println(testStack); + Assert.assertEquals("python", testStack.pop()); + Assert.assertEquals("C++", testStack.pop()); + Assert.assertEquals("java", testStack.pop()); + Assert.assertTrue(testStack.isEmpty()); + } + + /** + * + * Method: peek() + * + */ + @Test + public void testPeek() throws Exception { + Assert.assertEquals("沙僧", defaultStack.peek()); + } + + /** + * + * Method: size() + * + */ + @Test + public void testSize() throws Exception { + Assert.assertEquals(4, defaultStack.size()); + } + + /** + * + * Method: clear() + * + */ + @Test + public void testClear() throws Exception { + + Stack testStack = new Stack<>(); + testStack.push("java"); + testStack.push("C++"); + testStack.push("python"); + System.out.println("清空前:" + testStack); + testStack.clear(); + System.out.println("清空后:" + testStack); + Assert.assertTrue(testStack.isEmpty()); + + + } + + +} From d003ef57d55e50ce7aeff68e0592ce10f12a52de Mon Sep 17 00:00:00 2001 From: xdx54321 <20409287@qq.com> Date: Sun, 26 Feb 2017 01:33:30 +0800 Subject: [PATCH 19/68] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 168 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 149 insertions(+), 19 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2be72671b0..1a4c6f97dc 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,21 +2,7 @@ - - - - - - - - - - - - - - - + @@ -263,6 +249,42 @@ @@ -1079,11 +1209,11 @@ - - + @@ -1096,7 +1226,7 @@ - + From 1a1b18312c316cb133883b3602c2419ab47e8097 Mon Sep 17 00:00:00 2001 From: liyao1 Date: Sun, 26 Feb 2017 08:59:07 +0800 Subject: [PATCH 20/68] first week homework --- group06/547958234/README.md | 0 .../src/com/coding/basic/ArrayList.java | 48 ++++++++ .../src/com/coding/basic/BinaryTreeNode.java | 55 +++++++++ .../src/com/coding/basic/Iterator.java | 7 ++ .../src/com/coding/basic/LinkedList.java | 116 ++++++++++++++++++ .../src/com/coding/basic/LinkedListTest.java | 20 +++ .../547958234/src/com/coding/basic/List.java | 9 ++ .../547958234/src/com/coding/basic/Queue.java | 26 ++++ .../547958234/src/com/coding/basic/Stack.java | 27 ++++ 9 files changed, 308 insertions(+) create mode 100644 group06/547958234/README.md create mode 100644 group06/547958234/src/com/coding/basic/ArrayList.java create mode 100644 group06/547958234/src/com/coding/basic/BinaryTreeNode.java create mode 100644 group06/547958234/src/com/coding/basic/Iterator.java create mode 100644 group06/547958234/src/com/coding/basic/LinkedList.java create mode 100644 group06/547958234/src/com/coding/basic/LinkedListTest.java create mode 100644 group06/547958234/src/com/coding/basic/List.java create mode 100644 group06/547958234/src/com/coding/basic/Queue.java create mode 100644 group06/547958234/src/com/coding/basic/Stack.java diff --git a/group06/547958234/README.md b/group06/547958234/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/group06/547958234/src/com/coding/basic/ArrayList.java b/group06/547958234/src/com/coding/basic/ArrayList.java new file mode 100644 index 0000000000..30be14a906 --- /dev/null +++ b/group06/547958234/src/com/coding/basic/ArrayList.java @@ -0,0 +1,48 @@ +package com.coding.basic; + +import java.util.*; + +public class ArrayList implements List { + private int size = 0; + private static final int INCREMENT = 10; + + private Object[] elementData = new Object[100]; + + public void add(Object o){ + growLength(); + elementData[size++] = o; + } + public void add(int index, Object o){ + growLength(); + System.arraycopy(elementData, index, elementData, index+1, size-index); + elementData[index] = o; + size++; + } + + public Object get(int index){ + return elementData[index]; + } + + public Object remove(int index) { + //如果之前分配了很多内存,多次remove后是否需要将elementData手动缩小容量 + if (index > size) throw new IndexOutOfBoundsException("index: "+index+", size: "+size); + Object retVal = elementData[index]; + System.arraycopy(elementData, index+1, elementData, index, size-(index+1)); + elementData[--size] = null; + return retVal; + } + + public int size(){ + return this.size; + } + public Iterator iterator(){ + return null; + } + + private void growLength() { + if (this.size == elementData.length) { + elementData = Arrays.copyOf(elementData, elementData.length+INCREMENT); + } + } + +} diff --git a/group06/547958234/src/com/coding/basic/BinaryTreeNode.java b/group06/547958234/src/com/coding/basic/BinaryTreeNode.java new file mode 100644 index 0000000000..4dff1cdb31 --- /dev/null +++ b/group06/547958234/src/com/coding/basic/BinaryTreeNode.java @@ -0,0 +1,55 @@ +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) { + if (o < this.data) { + if (this.left != null) { + this.left.insert(o); + } else { + BinaryTreeNode node = new BinaryTreeNode(); + node.data = o; + this.left = node; + } + } + if (o > this.data) { + if (this.right != null) { + this.right.insert(o); + } else { + BinaryTreeNode node = new BinaryTreeNode(); + node.data = o; + this.right = node; + } + } + return this; + } + +} diff --git a/group06/547958234/src/com/coding/basic/Iterator.java b/group06/547958234/src/com/coding/basic/Iterator.java new file mode 100644 index 0000000000..dbe8b9afb2 --- /dev/null +++ b/group06/547958234/src/com/coding/basic/Iterator.java @@ -0,0 +1,7 @@ +package com.coding.basic; + +public interface Iterator { + public boolean hasNext(); + public Object next(); + +} diff --git a/group06/547958234/src/com/coding/basic/LinkedList.java b/group06/547958234/src/com/coding/basic/LinkedList.java new file mode 100644 index 0000000000..bc4dd44b5b --- /dev/null +++ b/group06/547958234/src/com/coding/basic/LinkedList.java @@ -0,0 +1,116 @@ +package com.coding.basic; + +import sun.jvm.hotspot.debugger.win32.coff.AuxBfEfRecord; + +public class LinkedList implements List { + + private Node head; + private int size; + + public void add(Object o) { + if (this.size == 0) { + addFirst(o); + } else { + Node node = findNode(size - 1); + Node newNode = new Node(); + newNode.data = o; + newNode.next = null; + node.next = newNode; + this.size++; + } + } + + public void add(int index, Object o) { + ensureNoOverStep(index); + if (index == 0) { + addFirst(o); + } else if (index == this.size) { + addLast(o); + } else { + Node beforeNode = findNode(index - 1); + Node newNode = new Node(); + newNode.data = o; + newNode.next = beforeNode.next; + beforeNode.next = newNode; + this.size++; + } + + } + + public Object get(int index) { + ensureNoOverStep(index); + Node node = findNode(index); + return node.data; + } + + public Object remove(int index) { + //只需要把对应节点从链表中摘出来就行了? + ensureNoOverStep(index); + if (index == 0) { + return removeFirst(); + } else if (index == this.size - 1) { + return removeLast(); + } else { + Node beforeNode = findNode(index - 1); + Node selectNode = beforeNode.next; + beforeNode.next = selectNode.next; + this.size--; + return selectNode.data; + } + } + + public int size() { + return this.size; + } + + public void addFirst(Object o) { + Node node = new Node(); + node.data = o; + node.next = this.head; + this.head = node; + this.size++; + } + + public void addLast(Object o) { + add(o); + } + + public Object removeFirst() { + Node node = new Node(); + node = head; + head = head.next; + this.size--; + return node.data; + } + + public Object removeLast() { + Node beforeNode = findNode(this.size - 2); + Node node = beforeNode.next; + beforeNode.next = null; + this.size--; + return node.data; + } + + public Iterator iterator() { + return null; + } + + private static class Node { + Object data; + Node next; + } + + private Node findNode(int index) { + ensureNoOverStep(index); + Node node = this.head; + while (index > 0) { + node = node.next; + index--; + } + return node; + } + + private void ensureNoOverStep(int index) { + if (index > this.size) throw new IndexOutOfBoundsException("Index: " + index + ", size: " + this.size); + } +} diff --git a/group06/547958234/src/com/coding/basic/LinkedListTest.java b/group06/547958234/src/com/coding/basic/LinkedListTest.java new file mode 100644 index 0000000000..afe137351f --- /dev/null +++ b/group06/547958234/src/com/coding/basic/LinkedListTest.java @@ -0,0 +1,20 @@ +package com.coding.basic; + +import com.coding.basic.LinkedList; +/** + * Created by mac on 2017/2/21. + */ +public class LinkedListTest { + public static void main(String[] args) { + LinkedList l = new LinkedList(); + l.add(0); + l.add(1); + l.add(2); + l.add(3,3); + Object ret = l.remove(1); + + for(int i=0;i Date: Sun, 26 Feb 2017 09:39:33 +0800 Subject: [PATCH 21/68] =?UTF-8?q?=E6=8F=90=E4=BA=A4easonzhang1992=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../git\345\221\275\344\273\244.txt" | 11 -- group07/1058267830/week1/.classpath | 8 ++ group07/1058267830/week1/.project | 17 +++ .../.settings/org.eclipse.jdt.core.prefs | 11 ++ .../week1/src/com/coding/basic/ArrayList.java | 108 ++++++++++++++++++ .../src/com/coding/basic/BinaryTree.java | 78 +++++++++++++ .../src/com/coding/basic/BinaryTreeNode.java | 16 +++ .../week1/src/com/coding/basic/Iterator.java | 8 ++ .../src/com/coding/basic/LinkedList.java | 97 ++++++++++++++++ .../week1/src/com/coding/basic/List.java | 14 +++ .../week1/src/com/coding/basic/Node.java | 39 +++++++ .../week1/src/com/coding/basic/Queue.java | 25 ++++ .../week1/src/com/coding/basic/Stack.java | 29 +++++ .../test/com/coding/test/TestArrayList.java | 47 ++++++++ .../test/com/coding/test/TestBinaryTree.java | 29 +++++ .../test/com/coding/test/TestLinkedList.java | 40 +++++++ .../week1/test/com/coding/test/TestQueue.java | 26 +++++ .../week1/test/com/coding/test/TestStack.java | 31 +++++ 18 files changed, 623 insertions(+), 11 deletions(-) delete mode 100644 "group07/1058267830/git\345\221\275\344\273\244.txt" create mode 100644 group07/1058267830/week1/.classpath create mode 100644 group07/1058267830/week1/.project create mode 100644 group07/1058267830/week1/.settings/org.eclipse.jdt.core.prefs create mode 100644 group07/1058267830/week1/src/com/coding/basic/ArrayList.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/BinaryTree.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/BinaryTreeNode.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/Iterator.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/LinkedList.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/List.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/Node.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/Queue.java create mode 100644 group07/1058267830/week1/src/com/coding/basic/Stack.java create mode 100644 group07/1058267830/week1/test/com/coding/test/TestArrayList.java create mode 100644 group07/1058267830/week1/test/com/coding/test/TestBinaryTree.java create mode 100644 group07/1058267830/week1/test/com/coding/test/TestLinkedList.java create mode 100644 group07/1058267830/week1/test/com/coding/test/TestQueue.java create mode 100644 group07/1058267830/week1/test/com/coding/test/TestStack.java diff --git "a/group07/1058267830/git\345\221\275\344\273\244.txt" "b/group07/1058267830/git\345\221\275\344\273\244.txt" deleted file mode 100644 index 8bcf2ffa0f..0000000000 --- "a/group07/1058267830/git\345\221\275\344\273\244.txt" +++ /dev/null @@ -1,11 +0,0 @@ -װgit guigit bash -1.¡ -git clone git@github.com:leijing1992/coding2017.git -2.޸ĵļ -git add -A -3.ύݴ -git commit -m "ύ***" -4.master -git pull origin master -5.ύmaster -git push origin master \ No newline at end of file diff --git a/group07/1058267830/week1/.classpath b/group07/1058267830/week1/.classpath new file mode 100644 index 0000000000..91c6d8f6c5 --- /dev/null +++ b/group07/1058267830/week1/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/group07/1058267830/week1/.project b/group07/1058267830/week1/.project new file mode 100644 index 0000000000..d3e8bd8c59 --- /dev/null +++ b/group07/1058267830/week1/.project @@ -0,0 +1,17 @@ + + + week1 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/group07/1058267830/week1/.settings/org.eclipse.jdt.core.prefs b/group07/1058267830/week1/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..7341ab1683 --- /dev/null +++ b/group07/1058267830/week1/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +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.7 diff --git a/group07/1058267830/week1/src/com/coding/basic/ArrayList.java b/group07/1058267830/week1/src/com/coding/basic/ArrayList.java new file mode 100644 index 0000000000..8d05511d8a --- /dev/null +++ b/group07/1058267830/week1/src/com/coding/basic/ArrayList.java @@ -0,0 +1,108 @@ +package com.coding.basic; + +public class ArrayList implements List, Iterator { + + private Object[] obj ; + private int length; // 数组总长度 + private int size; // 元素个数 + private int currentIndex; // 当前索引位置,默认为-1 + + public int getLength() { + return length; + } + + public ArrayList(){ + this.obj = new Object[10]; + this.length = 10; + this.size = 0; + this.currentIndex = -1; + } + + public ArrayList(int initSize){ + this.obj = new Object[initSize]; + this.length = initSize; + this.size = 0; + this.currentIndex = -1; + } + + @Override + public void add(Object o) { + if(this.size < length){ + obj[size] = o; + this.size++; + + }else{ + // 扩容,add数据 + Object[] obj1 = new Object[length * 2]; + System.arraycopy(obj, 0, obj1, 0, length); + this.length = this.length * 2; + this.obj = obj1; + obj[this.size] = o; + this.size++; + } + } + + @Override + public void add(int index, Object o) { + if(index < length){ + // 容量扩1,add数据 + Object[] obj1 = new Object[length + 1]; + System.arraycopy(obj, 0, obj1, 0, index); + System.arraycopy(obj, index, obj1, index+1, length-index); + obj1[index] = o; + this.obj = obj1; + this.length++; + this.size++; + }else{ + // 容量扩到index+1, add数据 + Object[] obj1 = new Object[index + 1]; + System.arraycopy(obj, 0, obj1, 0, length); + obj1[index] = o; + this.obj = obj1; + this.length = index + 1; + this.size++; + } + } + + @Override + public Object get(int index) { + if(index >= length) + throw new RuntimeException("数组越界了..."); + return this.obj[index]; + } + + @Override + public Object remove(int index) { + if(index >= length) + throw new RuntimeException("数组越界了..."); + Object tmp = obj[index];// 取值,最后返回 + Object[] obj1 = new Object[length -1]; + System.arraycopy(obj, 0, obj1, 0, index); + System.arraycopy(obj, index+1, obj1, index, length-index-1); + this.obj = obj1; + this.length--; + this.size--; + return tmp; + } + + @Override + public int size() { + return this.size; + } + + @Override + public boolean hasNext() { + if(currentIndex == length-1){ + return false; + }else{ + currentIndex++; + return true; + } + } + + @Override + public Object next() { + return this.get(currentIndex); + } + +} diff --git a/group07/1058267830/week1/src/com/coding/basic/BinaryTree.java b/group07/1058267830/week1/src/com/coding/basic/BinaryTree.java new file mode 100644 index 0000000000..e326a21f75 --- /dev/null +++ b/group07/1058267830/week1/src/com/coding/basic/BinaryTree.java @@ -0,0 +1,78 @@ +package com.coding.basic; + +public class BinaryTree { + private BinaryTreeNode root; // 根节点 + public BinaryTree( ){ + BinaryTreeNode node = new BinaryTreeNode(); + this.root = node; + } + + public boolean isEmpty(){ + return this.root == null; + } + + public void insert(Object o){ + // 如果是第一次添加节点,就是root节点 + if(root.data == null){ + BinaryTreeNode bnode = new BinaryTreeNode(o, null, null); + root = bnode; + }else{ + insert(o, root); + } + } + + // 递归添加非root节点 + private BinaryTreeNode insert(Object o, BinaryTreeNode node) { + if(node == null){ + BinaryTreeNode bnode = new BinaryTreeNode(o, null, null); + return bnode; + } + if((int)o <= (int)node.data){ + node.left = insert(o, node.left); + }else{ + node.right = insert(o, node.right); + } + + return node; + } + + // 中序遍历 + public void middlePrint(){ + middleOrder(this.root); + } + + private void middleOrder(BinaryTreeNode node) { + if(node != null){ + middleOrder(node.left); + System.out.print(node.data + " "); + middleOrder(node.right); + } + } + + // 前序遍历 + public void prePrint(){ + preOrder(this.root); + } + + private void preOrder(BinaryTreeNode node) { + if(node != null){ + System.out.print(node.data + " "); + preOrder(node.left); + preOrder(node.right); + } + } + + // 后序遍历 + public void postPrint(){ + postOrder(this.root); + } + + private void postOrder(BinaryTreeNode node) { + if(node != null){ + postOrder(node.right); + System.out.print(node.data + " "); + postOrder(node.left); + } + } + +} diff --git a/group07/1058267830/week1/src/com/coding/basic/BinaryTreeNode.java b/group07/1058267830/week1/src/com/coding/basic/BinaryTreeNode.java new file mode 100644 index 0000000000..a9e6593160 --- /dev/null +++ b/group07/1058267830/week1/src/com/coding/basic/BinaryTreeNode.java @@ -0,0 +1,16 @@ +package com.coding.basic; + +public class BinaryTreeNode { + + protected Object data; + protected BinaryTreeNode left; + protected BinaryTreeNode right; + + public BinaryTreeNode(){} + public BinaryTreeNode(Object data, BinaryTreeNode left, BinaryTreeNode right){ + this.data = data; + this.left = left; + this.right = right; + } + +} diff --git a/group07/1058267830/week1/src/com/coding/basic/Iterator.java b/group07/1058267830/week1/src/com/coding/basic/Iterator.java new file mode 100644 index 0000000000..d369bbc50c --- /dev/null +++ b/group07/1058267830/week1/src/com/coding/basic/Iterator.java @@ -0,0 +1,8 @@ +package com.coding.basic; + +public interface Iterator { + + public boolean hasNext(); + + public Object next(); +} diff --git a/group07/1058267830/week1/src/com/coding/basic/LinkedList.java b/group07/1058267830/week1/src/com/coding/basic/LinkedList.java new file mode 100644 index 0000000000..df65b13601 --- /dev/null +++ b/group07/1058267830/week1/src/com/coding/basic/LinkedList.java @@ -0,0 +1,97 @@ +package com.coding.basic; + +public class LinkedList implements List, Iterator{ + private Node head; + private Node tail; + private Node currentNode; + private int size; + + public LinkedList(){ + this.head = new Node(null); + this.tail = head; + this.currentNode = head; + this.size = 0; + } + + @Override + public void add(Object o) { + Node node = new Node(o, null); + tail.setNext(node); + tail = node; + size++; + } + + @Override + public void add(int index, Object o) { + if(index < 0 || index > size+1){ + throw new RuntimeException("插入的位置错误..."); + } + Node pre = head; // 得到待插入位置的前一个节点 + for(int i=0; i= size){ + throw new RuntimeException("index参数错误..."); + } + Node node = head; // 得到待插入位置的前一个节点 + for(int i=0; i<=index; i++){ + node = node.getNext(); + } + return node; + } + + @Override + public Object remove(int index) { + if(index < 0 || index >= size){ + throw new RuntimeException("index参数错误..."); + } + Node pre = head; // 得到待删除位置的前一个节点 + for(int i=0; i Date: Sun, 26 Feb 2017 10:12:31 +0800 Subject: [PATCH 22/68] =?UTF-8?q?236995728=E6=8F=90=E4=BA=A4=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- group06/236995728/.classpath | 7 + group06/236995728/.gitignore | 1 + group06/236995728/.project | 17 ++ .../.settings/org.eclipse.jdt.core.prefs | 11 ++ .../src/com/coding/basic/ArrayList.java | 92 +++++++++++ .../src/com/coding/basic/ArrayListTest.java | 82 ++++++++++ .../src/com/coding/basic/BinaryTreeNode.java | 32 ++++ .../src/com/coding/basic/Iterator.java | 6 + .../src/com/coding/basic/LinkedList.java | 149 ++++++++++++++++++ .../src/com/coding/basic/LinkedListTest.java | 78 +++++++++ .../236995728/src/com/coding/basic/List.java | 14 ++ .../236995728/src/com/coding/basic/Queue.java | 45 ++++++ .../src/com/coding/basic/QueueTest.java | 53 +++++++ .../236995728/src/com/coding/basic/Stack.java | 52 ++++++ .../src/com/coding/basic/StackTest.java | 58 +++++++ 15 files changed, 697 insertions(+) create mode 100644 group06/236995728/.classpath create mode 100644 group06/236995728/.gitignore create mode 100644 group06/236995728/.project create mode 100644 group06/236995728/.settings/org.eclipse.jdt.core.prefs create mode 100644 group06/236995728/src/com/coding/basic/ArrayList.java create mode 100644 group06/236995728/src/com/coding/basic/ArrayListTest.java create mode 100644 group06/236995728/src/com/coding/basic/BinaryTreeNode.java create mode 100644 group06/236995728/src/com/coding/basic/Iterator.java create mode 100644 group06/236995728/src/com/coding/basic/LinkedList.java create mode 100644 group06/236995728/src/com/coding/basic/LinkedListTest.java create mode 100644 group06/236995728/src/com/coding/basic/List.java create mode 100644 group06/236995728/src/com/coding/basic/Queue.java create mode 100644 group06/236995728/src/com/coding/basic/QueueTest.java create mode 100644 group06/236995728/src/com/coding/basic/Stack.java create mode 100644 group06/236995728/src/com/coding/basic/StackTest.java diff --git a/group06/236995728/.classpath b/group06/236995728/.classpath new file mode 100644 index 0000000000..b387714202 --- /dev/null +++ b/group06/236995728/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/group06/236995728/.gitignore b/group06/236995728/.gitignore new file mode 100644 index 0000000000..3e2fcc7171 --- /dev/null +++ b/group06/236995728/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/group06/236995728/.project b/group06/236995728/.project new file mode 100644 index 0000000000..2858b5b710 --- /dev/null +++ b/group06/236995728/.project @@ -0,0 +1,17 @@ + + + 2017Learning + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/group06/236995728/.settings/org.eclipse.jdt.core.prefs b/group06/236995728/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..bb35fa0a87 --- /dev/null +++ b/group06/236995728/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/group06/236995728/src/com/coding/basic/ArrayList.java b/group06/236995728/src/com/coding/basic/ArrayList.java new file mode 100644 index 0000000000..54f7ee73d5 --- /dev/null +++ b/group06/236995728/src/com/coding/basic/ArrayList.java @@ -0,0 +1,92 @@ +package com.coding.basic; + +import java.util.Arrays; + +/** + * 2017/2/24 + * @author 236995728 + * + */ +public class ArrayList implements List { + + private static int size = 0; + + private static Object[] elementData = new Object[100]; + + /** + * 添加元素 + */ + @Override + public void add(Object o){ + if(size >= elementData.length){ + grow(size); + } + elementData[size++] = o; + } + + /** + * 按索引添加元素 + */ + @Override + public void add(int index, Object o){ + if(index < 0){ + throw new IllegalArgumentException("param invalid"); + } + if(index >= elementData.length){ + grow(index); + } + for(int i=index; i<=size; i++){ + elementData[i] = elementData[i+1]; + } + elementData[index] = o; + size ++; + } + + /** + * 根据索引获取元素 + */ + @Override + public Object get(int index){ + if(index<0 || index >size){ + throw new IllegalArgumentException("param invalid"); + } + return elementData[index]; + } + + /** + * 根据索引删除元素 + */ + @Override + public Object remove(int index){ + if(index<0 || index >size){ + throw new IllegalArgumentException("param invalid"); + } + Object o = elementData[index]; + for(int i=index;i>1); + elementData = Arrays.copyOf(elementData, newCapacity); + } +} diff --git a/group06/236995728/src/com/coding/basic/ArrayListTest.java b/group06/236995728/src/com/coding/basic/ArrayListTest.java new file mode 100644 index 0000000000..1159bb1829 --- /dev/null +++ b/group06/236995728/src/com/coding/basic/ArrayListTest.java @@ -0,0 +1,82 @@ +package com.coding.basic; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +/** + * 2017/2/24 + * @author 236995728 + * + */ +public class ArrayListTest { + private static ArrayList list = new ArrayList(); + + @Before + public void setUp() throws Exception { + for(int i=0;i<10;i++){ + list.add(i); + System.out.println(list.get(i)); + } + } + + @Test + public void testAddObject() { + list.add("www"); + assertEquals("www", list.get(10)); + } + + @Test + public void testAddIntObject() { + list.add(101, 101); + assertEquals(101, list.get(101)); + } + + @Test(expected = IllegalArgumentException.class) + public void testAddIntObjectException1(){ + list.add(-1, -1); + } + + @Test + public void testGet() { + assertEquals(1, list.get(1)); + } + + @Test(expected = IllegalArgumentException.class) + public void testGetException1(){ + list.get(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testGetException2(){ + list.get(11); + } + + @Test + public void testRemove() { + list.remove(3); + assertEquals(4, list.get(3)); + } + + @Test(expected = IllegalArgumentException.class) + public void testRemoveException1(){ + list.remove(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testRemoveException2(){ + list.remove(1000000000); + } + + @Test + public void testSize() { + assertEquals(10, list.size()); + } + + @Test + public void testIterator() { + fail("Not yet implemented"); + } + +} diff --git a/group06/236995728/src/com/coding/basic/BinaryTreeNode.java b/group06/236995728/src/com/coding/basic/BinaryTreeNode.java new file mode 100644 index 0000000000..266eff3d56 --- /dev/null +++ b/group06/236995728/src/com/coding/basic/BinaryTreeNode.java @@ -0,0 +1,32 @@ +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/group06/236995728/src/com/coding/basic/Iterator.java b/group06/236995728/src/com/coding/basic/Iterator.java new file mode 100644 index 0000000000..ff93e30377 --- /dev/null +++ b/group06/236995728/src/com/coding/basic/Iterator.java @@ -0,0 +1,6 @@ +package com.coding.basic; + +public interface Iterator { + public boolean hasNext(); + public Object next(); +} diff --git a/group06/236995728/src/com/coding/basic/LinkedList.java b/group06/236995728/src/com/coding/basic/LinkedList.java new file mode 100644 index 0000000000..57ee5a6dd9 --- /dev/null +++ b/group06/236995728/src/com/coding/basic/LinkedList.java @@ -0,0 +1,149 @@ +package com.coding.basic; + +/** + * 2017/2/24 + * @author 236995728 + * 单链表 + */ +public class LinkedList implements List { + + private Node head = new Node(null,null); + private Node current = new Node(null, null); + + private int size = 0; + + /** + * 在尾节点添加节点 + */ + @Override + public void add(Object o){ + Node newNode = new Node(null,o); + if(head.next == null){ + head.next = newNode; + }else{ + current.next = newNode; + } + current = newNode; + size ++; + } + + /** + * 按照索引添加节点 + */ + @Override + public void add(int index , Object o){ + if(index <0 || index > size){ + throw new IndexOutOfBoundsException("param invalid"); + } + Node node = head; + Node newNode = new Node(null,o); + for(int i=0; i size){ + throw new IndexOutOfBoundsException("param invalid"); + } + Node node = head; + for(int i=0; i size){ + throw new IndexOutOfBoundsException("param invalid"); + } + Node node = head; + Node nextNode = null; + Object o = null; + for(int i=0; i Date: Sun, 26 Feb 2017 10:18:43 +0800 Subject: [PATCH 23/68] =?UTF-8?q?236995728word=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...64\347\232\204\345\205\263\347\263\273.docx" | Bin 0 -> 12398 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "group06/236995728/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" diff --git "a/group06/236995728/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" "b/group06/236995728/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" new file mode 100644 index 0000000000000000000000000000000000000000..fa7a796a74472df3f58fd20f7b52d78ed38132cd GIT binary patch literal 12398 zcmeHt^Y@&7CT#Tuwh9I@+WMi#$Gx<`s@P=EU^r-T+fLLiwz z%?1vo&Yj{2i$6Ia!N8J>ZfRkc z!4HT-xs}MgEQGJ_Zs zSlsw(T27f(_FCo(HB3PiSSz3S&I$n%P246ffOlUZ7(-65LgHei6)i7k^+PIdBcFuz z8eE(OM7HOTiM_?;jPSg1$7?Xl+#SLG^$MG^am!5r%fXDFe!A4W`2@^&+s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gpO^(U8j8f({z$w#6T!LT~i038e_WGb0?5_O8Fg9W@jT3roscH^DH$jZoP z6|CuscDEsoeo-Z<5w4Q7w>H)#0?j3NCj>K>jh|X_O)VMnN8wGIWwf5rF-rSYRCSvK z)T3MsyIffIs!QKJP3WUrbe7z|`BLrQMMtOX^}>;InVBT{W$|6nZba!S?;G}t*^VVa zrVfH}+^kf)UU=*?%!0?oHSFQDh>BDDm6H3S{F1RCOi^o3-SYd6>#LXlY^}k-89*G* zKPP5`2K}Y{Lz=dd>|X`^HI4Mo=mb#W+@F$4e+B+EzwXb#8qf{@|CMd`tE69ZuKtj9 z0Lni9TL#vz@L!V({(wuq{x|&B6oX$y{CZ*Zhlp|zo%XK-%b%#UU*W&fvVXwej1V*QH#E0geNbRyB8(7*Evzrue# j;Qb+hkMwu#{pYx+Bnt&HkDn>auK-;j<|2jRXYKz1lAHbI literal 0 HcmV?d00001 From d7cfb7c7124a055a9a03230e4864cd40f50e9f19 Mon Sep 17 00:00:00 2001 From: nanjing_yangyang Date: Sun, 26 Feb 2017 10:28:37 +0800 Subject: [PATCH 24/68] =?UTF-8?q?236995728=E6=8F=90=E4=BA=A4=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E4=B9=8B=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...64\347\232\204\345\205\263\347\263\273.docx" | Bin 0 -> 12398 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "group06/236995728/src/com/coding/basic/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" diff --git "a/group06/236995728/src/com/coding/basic/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" "b/group06/236995728/src/com/coding/basic/CPU\357\274\214\345\206\205\345\255\230\357\274\214 \347\241\254\347\233\230\357\274\214\346\214\207\344\273\244\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.docx" new file mode 100644 index 0000000000000000000000000000000000000000..fa7a796a74472df3f58fd20f7b52d78ed38132cd GIT binary patch literal 12398 zcmeHt^Y@&7CT#Tuwh9I@+WMi#$Gx<`s@P=EU^r-T+fLLiwz z%?1vo&Yj{2i$6Ia!N8J>ZfRkc z!4HT-xs}MgEQGJ_Zs zSlsw(T27f(_FCo(HB3PiSSz3S&I$n%P246ffOlUZ7(-65LgHei6)i7k^+PIdBcFuz z8eE(OM7HOTiM_?;jPSg1$7?Xl+#SLG^$MG^am!5r%fXDFe!A4W`2@^&+s{G-gL^9v zwzm)fz{?8+K80^qRz1uJ zLT5owK~rtY%U#&H3QQ)GE7(ggu)5N6Xe*0W3(rq{i;Lj;2gZ^k(=!Q^Ud|a3uA7Pa z=eWu0h~aH;^LGY4x(}@$fTWPtd=`&+hi!!Py&q;z!(`Gl!$A?+7~vDR&~dk6sbigJ zUungDd@X!sNlG&@YeHU=o9U>&aFhCu?ej;Lxp^xoU2m8Ye)0BDg646YckpI{RVi!? zu`%82)%v|^hY5|WQC2kH>2YnCnJ6;i-j>4Sp0`dNdgXQ$_I(JUhs%ch!1Ul_riZHY zydS=YBglD1qFrmaWsjGkFMI_GOn>)}d0>t5HAopOAn(Bkz=FBkI{}&gr!Q0xN9`R^{J@gpFE0j=F3&q1la47|QdBD*#+BrEez0C7UWB6_&7>#dFo zDe0q0qvms`@>J&uf6kSOu5kCrS?|KngHFibA}hQXXg!JvD^7)xtu?KW2xzh6jC2hQ zY%(XU6l7<=2Z-fxt4y-IuS*2-;Io?we3oU3iV50d@7I8~HE@k^O4@g4RlrfoWbP~1 zKz9Gm5oU#OOH^;4w!Rs}We>q4ph_a>@De$Cz%8RipbLabV3rk&-51x84WA^6FkvlJ zqA%&p?JMpy&ivA$U!6I__*_rae^#05+^9XBeGyI9)_@k1^^K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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\221\250\346\226\207\347\253\240\345\234\260\345\235\200.txt" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "group06/799237637/\347\254\254\344\270\200\345\221\250\346\226\207\347\253\240\345\234\260\345\235\200.txt" diff --git "a/group06/799237637/\347\254\254\344\270\200\345\221\250\346\226\207\347\253\240\345\234\260\345\235\200.txt" "b/group06/799237637/\347\254\254\344\270\200\345\221\250\346\226\207\347\253\240\345\234\260\345\235\200.txt" new file mode 100644 index 0000000000..86c003d948 --- /dev/null +++ "b/group06/799237637/\347\254\254\344\270\200\345\221\250\346\226\207\347\253\240\345\234\260\345\235\200.txt" @@ -0,0 +1 @@ +http://blog.csdn.net/codingxiaozhupig/article/details/57150919 \ No newline at end of file From a676094b11a9d269d3929bda1f76e4ad6fbccb79 Mon Sep 17 00:00:00 2001 From: xdx54321 <20409287@qq.com> Date: Sun, 26 Feb 2017 11:54:28 +0800 Subject: [PATCH 26/68] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 454 +++++++++--------- .../java/xdx/homework/first/LinkedList.java | 245 +++++++++- .../xdx/homework/first/SortBinaryTree.java | 7 - .../xdx/homework/first/LinkedListTest.java | 222 +++++++++ 4 files changed, 683 insertions(+), 245 deletions(-) delete mode 100644 group07/20409287/src/main/java/xdx/homework/first/SortBinaryTree.java create mode 100644 group07/20409287/src/test/xdx/homework/first/LinkedListTest.java diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1a4c6f97dc..6a564d2e9c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,10 @@ + + + @@ -23,48 +26,11 @@ - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -73,8 +39,8 @@ - - + + @@ -83,48 +49,72 @@ - - - + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + - + - + @@ -151,7 +141,6 @@ @@ -216,7 +210,6 @@ - @@ -570,6 +563,7 @@ + @@ -590,11 +584,12 @@ + - - + + - + - + - @@ -657,8 +652,8 @@ - + - @@ -683,8 +678,8 @@ - + - @@ -709,8 +704,8 @@ - - - - - + + + + + - - - - - + + + + + @@ -1172,44 +1167,45 @@ - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - @@ -1217,12 +1213,13 @@ + + - @@ -1231,13 +1228,12 @@ - + - @@ -1255,7 +1251,7 @@ - @@ -1264,38 +1260,6 @@