Hallo
Ich habe einen InsertionSort (Direktes einfügen). Es sieht aus, als hätte ich was falsch gemacht, weil die Perfomance nicht stimmt, d. h. 10'000 Einträge 2 Sekunde -> 20'000 Einträge 4 Sekunden.
Seht ihr einen Fehler?
Ich habe einen InsertionSort (Direktes einfügen). Es sieht aus, als hätte ich was falsch gemacht, weil die Perfomance nicht stimmt, d. h. 10'000 Einträge 2 Sekunde -> 20'000 Einträge 4 Sekunden.
Seht ihr einen Fehler?
Java:
public class InsertionSort {
/**
*
* @param array
*/
public static void insertionSort(final Integer[] array){
int elt;
int j;
if(array == null){
return;
}
for(int i=1; i< array.length;i++){
elt = array[i];
j = i;
while ((j > 0) && (array[j-1] > elt)){
array[j] = array[j - 1];
j--;
}
array[j] = elt;
}
}
}