区间第K大
protected static int partitions(List<KDNode> data,int left,int right,int k,int pos){ int l = left,r = right; if(l==r) return l; KDNode key = data.get(l); while (l < r){ while(l < r && data.get(r).getVal(pos) > key.getVal(pos) ) r --; data.set(l,data.get(r)); while(l < r && data.get(l).getVal(pos) < key.getVal(pos) ) l ++; data.set(r,data.get(l)); } data.set(l,key); if ( l == k ) return l; if ( l < k ) return partitions(data,l+1,right,k,pos); if ( l > k ) return partitions(data,left,l-1,k,pos); return -1; }