Java implementiert einen Auswahlsortierungsalgorithmus
public static void selectSort(int[] array) { for (int i = 0; i < array.length - 1; i++) { int min = i; for (int j = i + 1; j < array.length; j++ ) { if (array[j] < array[min]) { min = j; } } Sort.swap(array, i, min);//Exchange i und min } }
Auswahl-Sortierdiagramm
Das Obige ist der gesamte Inhalt dieses Artikels. Ich hoffe, er wird für alle hilfreich sein, die Auswahlsortierung in Java zu beherrschen.