private static void insertSort(int[] array) { for (int i = 0; i < array.length; i++) { int j=i; for (int k = i - 1; k >= 0; k--) { if (array[j] < array[k]) { int key = array[j]; array[j] = array[k]; array[k] = key; j--; } } } }
private static void insertSort(int[] array) { for (int i = 0; i < array.length; i++) { int j=i; for (int k = i - 1; k >= 0; k--) { if (array[j] < array[k]) { int key = array[j]; array[j] = array[k]; array[k] = key; j--; } } } }
转载于:https://www.cnblogs.com/xiangtingsulinlin/p/9354150.html