diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/ArrayList.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/ArrayList.java deleted file mode 100644 index c2acf20e4d..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/ArrayList.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -import javax.lang.model.element.Element; - -public class ArrayList implements List { - - private int size = 0; - - private Object[] elementData = new Object[100]; - - public void add(Object o){ - if (o == null){ - throw new NullPointerException("空对象"); - } - if (size >= 100){ - throw new RuntimeException("越界"); - } - elementData[size] = o; - size++; - } - public void add(int index, Object o){ - if (o == null){ - throw new NullPointerException("空对象"); - } - if (index >= 99){ - throw new RuntimeException("越界"); - } - for (int i = size; i >= index; i--) { - elementData[i + 1] = elementData[i]; - } - elementData[index] = o; - size++; - } - - public Object get(int index){ - if (index >= 100 || index < 0){ - throw new RuntimeException("越界"); - } - return elementData[index]; - } - - public Object remove(int index){ - if (index >= 100 || index < 0){ - throw new RuntimeException("越界"); - } - Object o = elementData[index]; - for (int i = index; i < size - 1; i++) { - elementData[i] = elementData[i + 1]; - } - size--; - return null; - } - - public int size(){ - return size; - } - - public Iterator iterator(){ - return null; - } - -} diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/BinaryTreeNode.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/BinaryTreeNode.java deleted file mode 100644 index 0381f88c69..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/BinaryTreeNode.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -public class BinaryTreeNode { - - private Object data; - private BinaryTreeNode left; - private BinaryTreeNode right; - - public Object getData() { - return data; - } - public void setData(Object data) { - this.data = data; - } - public BinaryTreeNode getLeft() { - return left; - } - public void setLeft(BinaryTreeNode left) { - this.left = left; - } - public BinaryTreeNode getRight() { - return right; - } - public void setRight(BinaryTreeNode right) { - this.right = right; - } - - public BinaryTreeNode insert(Object o){ - return null; - } - -} diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Iterator.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Iterator.java deleted file mode 100644 index 0e8394844b..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Iterator.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -public interface Iterator { - public boolean hasNext(); - public Object next(); - -} diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/LinkedList.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/LinkedList.java deleted file mode 100644 index d000967c19..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/LinkedList.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -public class LinkedList implements List { - - private Node head; - private int size; - - public void add(Object o){ - Node newNode = new Node(o); - if (head == null) { - head = newNode; - } - else{ - Node last = head.next; - while (last != null){ - last = last.next; - } - last = newNode; - } - size++; - - } - public void add(int index , Object o){ - Node dummy = new Node(); - dummy.next = head; - Node pre = dummy; - while (index > 0) { - pre = pre.next; - } - Node cur = new Node(o); - cur.next = pre.next; - pre.next = cur; - size++; - } - public Object get(int index){ - Node cur = head; - while (index > 0 && cur != null) { - cur = cur.next; - } - return cur; - } - public Object remove(int index){ - Node dummy = new Node(); - dummy.next = head; - Node pre = dummy; - while (index > 0) { - pre = pre.next; - } - Node cur = pre.next; - Node next = pre.next.next; - pre.next = next; - size--; - return cur; - - } - - public int size(){ - return size; - } - - public void addFirst(Object o){ - Node firstNode = new Node(o); - firstNode.next = head; - head = firstNode; - } - public void addLast(Object o){ - Node pre = new Node(); - while (pre.next != null){ - pre = pre.next; - } - Node lastNode = new Node(o); - pre.next = lastNode; - } - public Object removeFirst(){ - Node dummy = new Node(); - dummy.next = head; - dummy.next = head.next; - return dummy.next; - } - public Object removeLast(){ - Node pre = new Node(); - while (pre.next.next != null) { - pre = pre.next; - } - Node lastNode = pre.next.next; - pre.next = null; - return lastNode; - - } - public Iterator iterator(){ - return null; - } - - - private static class Node{ - public Node(Object o) { - // TODO Auto-generated constructor stub - } - public Node() { - // TODO Auto-generated constructor stub - } - Object data; - Node next; - - } - - - public boolean isEmpty() { - // TODO Auto-generated method stub - if (size() == 0){ - return false; - } - return true; - } - - -} diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/List.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/List.java deleted file mode 100644 index 56d67bdf29..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/List.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -public interface List { - public void add(Object o); - public void add(int index, Object o); - public Object get(int index); - public Object remove(int index); - public int size(); -} diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Queue.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Queue.java deleted file mode 100644 index f7cb7b1ad4..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Queue.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -public class Queue { - private LinkedList list = new LinkedList(); - public void enQueue(Object o){ - list.addLast(o); - } - - public Object deQueue(){ - if (!list.isEmpty()){ - return list.removeFirst(); - } - return "空队列"; - - } - - public boolean isEmpty(){ - if (list.size() == 0){ - return false; - } - return true; - } - - public int size(){ - return list.size(); - } -} diff --git a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Stack.java b/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Stack.java deleted file mode 100644 index a4229a7d12..0000000000 --- a/coding2017/group02/447809161Learning/src/com/github/hwjcc969/coding2017/basic/Stack.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.hwjcc969.coding2017.basic; - -public class Stack { - private ArrayList elementData = new ArrayList(); - private int size = 0; - - public void push(Object o){ - if (elementData.size() <= 99) - elementData.add(o); - size++; - - } - - public Object pop(){ - size--; - return elementData.remove(elementData.size() - 1); - - } - - public Object peek(){ - return elementData.get(elementData.size() - 1); - } - public boolean isEmpty(){ - if (size == 0) - return false; - return true; - } - public int size(){ - return size; - } -}