Zu dieser Karteikarte gibt es einen kompletten Satz an Karteikarten. Kostenlos!
8
Insertion Sort
public static void insertionSort(int [] array){
for (int i = 1; i < array.length; i++){
int j = i;
int m = array [i];
while (j > 0 && array[j - 1] > m){
array [j] = array[i - 1];
j --;
}
array[j] = m;
}
}
- stabil
- n, bei kleineren Folgen sehr gut, bei fast sortiertem Array gut,
for (int i = 1; i < array.length; i++){
int j = i;
int m = array [i];
while (j > 0 && array[j - 1] > m){
array [j] = array[i - 1];
j --;
}
array[j] = m;
}
}
- stabil
- n, bei kleineren Folgen sehr gut, bei fast sortiertem Array gut,

Karteninfo:
Autor: hristiana86
Oberthema: Informatik
Schule / Uni: HS
Ort: Mannheim
Veröffentlicht: 14.06.2010