public static void insertionSort(int[] a) { for (int i = 1; i < a.length; i++) { int key = a[i]; int j = i - 1; for (; j >= 0 && key < a[j]; j--) // asc a[j + 1] = a[j]; a[j + 1] = key; } } Previous Next ponxu / 2014-11-24 Categories 算法 Tags 算法