This flashcard is just one of a free flashcard set. See all flashcards!
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,

Flashcard info:
Author: hristiana86
Main topic: Informatik
School / Univ.: HS
City: Mannheim
Published: 14.06.2010