位图排序:
public int[] weituSort(int[] array){ for (int i = 0; i < array.length; i++) { set(array[i]); } int[] arrayCopy = new int[array.length]; int j = 0; for (int i = 0; i < N; i++) { if (get(i)>0){ arrayCopy[j++] = i; } } array = arrayCopy; return array; } public void set(int i){ store[i>>SHIFT] |= (1<<(i&MASK)); } public void clr(int i){ store[i>>SHIFT] &= ~(1<<(i&MASK)); } public int get(int i){ return store[i>>SHIFT] & (1<<(i&MASK)); }
但是好像没有快排快?不应该啊。。。