Skip to content

Commit

Permalink
my first homework
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiujm committed Mar 14, 2017
1 parent 0cc5d25 commit e05a0fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public Object remove(int index) {
}
Object removeElement = elementData[index];
moveForward(elementData,index+1,size-1,1);
// 最后一位置为null;!!
elementData[size-1] = null;
size--;
return removeElement;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ private BinaryTreeNode add(BinaryTreeNode node, Integer key) {
}
Integer value = node.getValue();
if(value.compareTo(key) > 0){
node.left =add(node.left,key);
node.setLeft(add(node.left,key));

}else if(value.compareTo(key) < 0){
node.right=add(node.right,key);
node.setRight(add(node.right,key));

}
return node;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.github.qq809203042.coding2017.basic.structurestest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

import com.github.qq809203042.coding2017.basic.structures.MyArrayList;

/*
Expand All @@ -8,6 +12,8 @@
public class MyArrayListTest {

public static void main(String[] args) {


MyArrayList mList = new MyArrayList();
mList.add(new String("hahah"));
mList.add(new String("heihei"));
Expand Down

0 comments on commit e05a0fb

Please sign in to comment.