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

几种常见的数据结构的JAVA实现

 依旧没有文字说明,只有少量的注释,二叉查找树有很多参考资料,这里就不多说了。下面奉上JAVA代码
package utility.structure;
import java.io.Serializable;
import java.security.InvalidParameterException;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
/**
*
* @author odie.tang
* @version 1.0 11/09/09
*/
public class BinarySearchTree<E> implements Comparable<E>,Serializable{

private static final long serialVersionUID = -8154673525487170187L;
/**
* The comparator, or null if priority queue uses elements'
* natural ordering.
*/
private Comparator<? super E> comparator = null;
private E data;
private BinarySearchTree<E> parent = null;
private BinarySearchTree<E> leftChild = null;
private BinarySearchTree<E> rightChild = null;
/**
* level indicates node's level in the whole tree, eg: root's level is 1, and its children's level is 2...
*/
private int level;

/**
* to identify the whether the child is a left child or a right one
*/
enum Child{left,right};

public BinarySearchTree() {
this.level = 0;
}

public BinarySearchTree(Comparator<? super E> comparator){

this.comparator = comparator;

this.level = 0;
}

public BinarySearchTree(E root) {

this(root,null);
}

public BinarySearchTree(E root,Comparator<? super E> comparator){

this.data = root;

this.comparator = comparator;

this.level = 1;
}

private BinarySearchTree(BinarySearchTree<E> parent,Child childType,E child){

this.data = child;

this.parent = parent;

this.level = parent.level + 1;

if (childType == Child.left)
parent.leftChild = this;
else
parent.rightChild = this;

this.comparator = parent.comparator;
}
public void add(E e){

if (this.level == 0){

this.level = 1;

this.data = e;
}
else{
BinarySearchTree<


相关文档:

非诚勿扰:2010应届毕业生 java程序员


个人简历
个人信息
姓名


朱金国
 
     
性别



出生日期

1988

1

9

                   
Email

zhujinguo2009@gmail.com
  ......

java删除文件夹

    1. package book.io;  
   2.  
   3. import java.io.File;  
   4.  
   5. /** 
   6.  *  
   7.  * @author XWZ 
   8.  * 20 ......

JAVA ME 手机程序入门级源码

 一个由 Carol Hamer 写的比较有代表性的源码,作者全力推荐,尤其是对于没有 J2ME 开发经验的朋友。自己动手敲出以下贴出的 Hello.java 和 HelloCanvas.java 源码,并运行,用心体会一下。相信你理解了此源码之后,即可步入 J2ME 开发。
注释都在源码里,运行环境自己配,自己动手看运行效果,理解之后,然后动手修 ......

冒泡排序算法的java实现

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class BubbleSort {
private static int a[] = new int[12];
private static BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
public static void bubbleSort(int a[], i ......

Java RMI分布式应用程序概述

 
RMI(Remote Method Invocation)
RMI是分布式对象软件包,它简化了在多台计算机上的JAVA应用之间的通信。
必须在jdk1.1以上
RMI用到的类
java.rmi.Remote 所有可以被远程调用的对象都必须实现该接口
java.rmi.server.UnicastRemoteObject 所有可以被远程调用的对象都必须扩展该类
什么是RMI
远程方法调用是 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号