n 1. 快速排序 近似O( 二 )

< k; i++){for(int j = array.length - 1; j > i; j--){if(array[j] > array[j-1]){swap(array, j, j-1);}}}}public void swap(int[] array, int i, int j){int temp = array[i];array[i] = array[j];array[j] = temp;}public static void main(String[] args){BeforeKMaopao sort = new BeforeKMaopao();int[] array = new int[]{50,10,90,30,70,40,80,60,20};sort.sort(array, 4);for(int i = 0 ; i < 4; i++){System.out.print(array[i] + " ");}}}