二叉树(一)
来源:互联网 发布:轻量 linux 桌面 编辑:程序博客网 时间:2024/04/26 19:24
package cn.jbit.nodetree.test;public class Node { private int value; //介值 private Node left; //二叉树左 private Node rigth; //二叉树右 public Node(int value){ this.value = value; } public void add(int value){ if(value > this.value){ if(rigth != null){ rigth.add(value); }else{ Node node = new Node(value); rigth = node; } }else{ if(left != null){ left.add(value); }else{ Node node = new Node(value); left = node; } } } public boolean find(int value){ if(value == this.value) { return true; }else if(value > this.value){ if(rigth == null) return false; return rigth.find(value); }else{ if(left == null) return false; return left.find(value); } }}
0 0
- 二叉树<总结一>
- 二叉树<总结一>
- 二叉树(一)
- 二叉树(一)
- 二叉树(一)
- 二叉树(一)
- 二叉树(一)
- 创建一二叉树
- 二叉树(一)
- 一、二叉查找树
- 二叉树(一)
- 树(一)二叉树
- 树与二叉树(一)
- 二叉查找树(一)
- 大话二叉树(一)
- 19 二叉查找树 (一)
- 二叉树的遍历(一)
- 二叉查找树(一)
- js复选框
- 转 angularjs controller的两种写法
- Android MediaCodec 资料
- jedis-JAVA操作Redis
- PVANET: 用于实时目标检测的深但轻量级神经网络
- 二叉树(一)
- LeetCode--Container With Most Water
- 在线linux 系统初步取证
- 二叉树(二)
- Android 获取内外置存储卡方法
- 规划问题求解的理论---线性代数
- C++、delphi、python Quick_Sort实现
- 二叉树(三)
- 简单记录LaTex的入门经过