其他分享
首页 > 其他分享> > 二叉树的插入、删除、查寻等接口实现和经典笔试题

二叉树的插入、删除、查寻等接口实现和经典笔试题

作者:互联网

代码实现:
class BSTNode<T extends Comparable>{
private T data; // 数据域
private BSTNode left; // 左孩子域
private BSTNode right; // 右孩子域

public BSTNode(T data, BSTNode<T> left, BSTNode<T> right) {
    this.data = data;
    this.left = left;
    this.right = right;
}

public T getData() {
    return data;
}

public void setData(T data) {
    this.data = data;
}

public BSTNode<T> getLeft() {
    return left;
}

public void setLeft(BSTNode<T> left) {
    this.left = left;
}

public BSTNode<T> getRight() {
    return right;
}

public void setRight(BSTNode<T> right) {
    this.right = right;
}

}

/**

标签:BSTNode,cur,BST,笔试,二叉树,查寻,return,null,root
来源: https://blog.csdn.net/cx_cx__cx/article/details/94407747