Skip to content

Commit

Permalink
添加迭代器的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
dongqisilent committed Feb 24, 2017
1 parent fb8a52f commit a0ebef1
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions group16/1325756593/src/com/dong/week1/BinaryTreeNode.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
package com.dong.week1;

public class BinaryTreeNode {
private TreeNode node;

private static class TreeNode{
private int key=0;
private TreeNode leftChild=null;
private TreeNode rightChild=null;

public TreeNode(){}

/**
* @param key ²ãÐò±àÂë
* @param data Êý¾ÝÓò
*/
public TreeNode(int key){
this.key=key;
this.leftChild=null;
this.rightChild=null;
}


}

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;
public TreeNode insert(TreeNode o){
if(node == null){
return o;
}
if(node.key > o.key){
return insert(o.leftChild);
}else{
return insert(node.leftChild);
}
}

}

0 comments on commit a0ebef1

Please sign in to comment.