¼¸ÖÖ³£¼ûµÄÊý¾Ý½á¹¹µÄ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<
Ïà¹ØÎĵµ£º
JOSSO
JOSSO(Java Open Single Sign-On)ÊÇÒ»¸ö¿ªÔ´µÄJ2EE-basedµÄSSO(SSO£ºµ¥Ò»µÇ¼¼¼ÊõÊÇÒ»ÖÖÈÏÖ¤ºÍÊÚȨ»úÖÆ£¬ËüÔÊÐí×¢²áÓû§Ö»ÐèÒªÔÚÈÎÒ»³ÉÔ±ÍøÕ¾ÉϵǼһ´Î£¬¶øºóÊÚȨ·ÃÎÊÆäËûÁ¬½ÓµÄ·ÖÖ§ÍøÕ¾£¬ÎÞÐèÔÙ½øÐÐÑéÖ¤µÇ¼)»ù´¡½á¹¹.ËüµÄÄ¿µÄÊÇÌṩһÖÖÓÃÀ´½â¾öÔÚͳһƽ̨ÉϽøÐÐÓû§¼¯ÖÐÈÏÖ¤µÄ·½°¸.
¸ü¶àJOSSOÐÅÏ ......
1. package book.io;
2.
3. import java.io.File;
4.
5. /**
6. *
7. * @author XWZ
8. * 20 ......
java ËÄÖÖ±éÀúListµÄ·½·¨¼°±È½Ï
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ListTest {
public static void main(String args[]){
List<Long> lists = new ArrayList<Long>();
for(Long i=0l;i<1000000l;i++){
......
import java.util.Random;
public class MathOperators {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//Ëæ»úÊýµÄ²úÉú
int[] arr = new int[10];
Random r = new Random();
for (int m = 0; m < arr.length; m++)
{
arr[m] = ......