Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanfangblues committed Feb 25, 2017
1 parent d9ce72e commit 580a174
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,21 @@ public BinaryTreeNode insert(Object o){
if ((int)newNode.getData()< val) {
if(nowNode.left==null){
nowNode.setLeft(newNode);
break;
} else {
nowNode = nowNode.left;
}
} else if((int)newNode.getData()> val){
if (nowNode.right==null ) {
nowNode.setRight(newNode);
break;
} else{
nowNode = newNode.right;

}
}else {
System.out.println("已存在元素结点");
throw new IllegalArgumentException();

throw new IllegalArgumentException("已存在元素结点");
}
}
}
Expand Down

0 comments on commit 580a174

Please sign in to comment.