- package com.eshore.sweetop.dataframe;
- import java.util.Random;
- import com.eshore.sweetop.data.KeyData;
- import com.eshore.sweetop.data.Node;
- /*
- * bintree
- */
- public class Bintree {
- private Node root;
- public void insert(Node node){
- Node y=null;
- Node x=root;
- while(x!=null){
- y=x;
- if(node.getData().getKey()<x.getData().getKey()){
- x=x.getLeft();
- }else{
- x=x.getRight();
- }
- }
- node.setParent(y);
- if(y==null){
- root=node;
- }else if(node.getData().getKey()<y.getData().getK
算法之二叉查找树
最新推荐文章于 2020-07-15 11:36:26 发布