From 22d30e299d5006d7c59306d5112b389160a3eee9 Mon Sep 17 00:00:00 2001 From: Lucifer Date: Sun, 26 Feb 2017 14:39:45 +0800 Subject: [PATCH] 441908378 week1 homework --- group12/441908378/ArrayList.java | 50 +++++++++++ group12/441908378/BinaryTreeNode.java | 47 ++++++++++ group12/441908378/LinkedList.java | 121 ++++++++++++++++++++++++++ group12/441908378/Queue.java | 39 +++++++++ group12/441908378/Stack.java | 30 +++++++ 5 files changed, 287 insertions(+) create mode 100755 group12/441908378/ArrayList.java create mode 100755 group12/441908378/BinaryTreeNode.java create mode 100755 group12/441908378/LinkedList.java create mode 100755 group12/441908378/Queue.java create mode 100755 group12/441908378/Stack.java diff --git a/group12/441908378/ArrayList.java b/group12/441908378/ArrayList.java new file mode 100755 index 0000000000..45e495867c --- /dev/null +++ b/group12/441908378/ArrayList.java @@ -0,0 +1,50 @@ +import java.util.Arrays; + +public class ArrayList { + +private int size = 0; + +private Object[] elementData = new Object[100]; + +public void enlargeCapacity(int minCapacity){ + int oldCapacity=elementData.length; + if(oldCapacityb){ + return left; + }else{ + return right; + } + } + + +} diff --git a/group12/441908378/LinkedList.java b/group12/441908378/LinkedList.java new file mode 100755 index 0000000000..0d0339bc01 --- /dev/null +++ b/group12/441908378/LinkedList.java @@ -0,0 +1,121 @@ +public class LinkedList { + +private Node head; + +private static class Node{ + Object data; + Node next; +} + +public boolean hasNext(Node a){ + if(a.next!=null){ + return true; + } + return false; +} + +public Node getIndex(int index){ + Node a=head.next; + for(int i=0;i