易截截图软件、单文件、免安装、纯绿色、仅160KB

java:手写二叉树BinaryTree添加和查询方法

package arrays.myArray;
public class BinaryTree {
 private Node root;
 // 添加数据
 public void add(int data) {
  // 递归调用
  if (null == root)
   root = new Node(data, null, null);
  else
   addTree(root, data);
 }
 private void addTree(Node rootNode, int data) {
  // 添加到左边
  if (rootNode.data > data) {
   if (rootNode.left == null)
    rootNode.left = new Node(data, null, null);
   else
    addTree(rootNode.left, data);
  } else {
   // 添加到右边
   if (rootNode.right == null)
    rootNode.right = new Node(data, null, null);
   else
    addTree(rootNode.right, data);
  }
 }
 // 查询数据
 public void show() {
  showTree(root);
 }
 private void showTree(Node node) {
  if (node.left != null) {
   showTree(node.left);
  }
  System.out.println(node.data);
  if (node.right != null) {
   showTree(node.right);
  }
 }
}
class Node {
 int data;
 Node left;
 Node right;
 public Node(int data, Node left, Node right) {
  this.data = data;
  this.left = left;
  this.right = right;
 }
}


相关文档:

传智播客JAVA培训OA项目 审批流转模块二


传智播客JAVA培训OA项目 审批流转模块二
虽然这两天学习的知识点是spring,但是我的观点就是学一个知识点就要学通吧,因为如果前面的知识都没有学会,又急着去学习新的东西,只会欠下越来越多的东西!这也是我学习的主张。说实在的,上一个项目OA项目的都没有理解得透彻,就急着去学,只会越来越大的压力,越来越没 ......

java Annotation 拼装SQL语句

声明字段映射
@Target(ElementType.FIELD)  
@Retention(RetentionPolicy.RUNTIME) 
public @interface FiledRef
{
    String fieldName();
}
声明表映射
@Target(ElementType.TYPE)  
@Retention(RetentionPolicy.RUNTIME)
public @interface TableRef
{
 & ......

中国公历算法&中国农历算法(JAVA)

中国公历算法不是太难,关键是星期值的确定。这里给出了简单算法: 
public static int dayOfWeek(int y, int m, int d) {
int w = 1; // 公历一年一月一日是星期一,所以起始值为星期日
y = (y-1)%400 + 1; //&n ......

java:double类型截取俩位小数,不取舍,

public class Split{
 public static void main(String[] args){
       double pai = 3.14159;
        findTwo(pai);
  public static void findTwo(double value){
    System.out.println(new DecimalFormat("0.##"). ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号