This flashcard is just one of a free flashcard set. See all flashcards!
6
Selection Sort
public static void selectionSort(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[min] > array [j]){
min = j;
}
if (min != i){
swap (array, min, i);
}
}
}
- n*n
- instabil**
for (int i = 0; i < array.length - 1; i){
int min = i;
for(int j = i + 1; j < array.length; j){
if (array[min] > array [j]){
min = j;
}
if (min != i){
swap (array, min, i);
}
}
}
- n*n
- instabil**
Flashcard info:
Author: hristiana86
Main topic: Informatik
School / Univ.: HS
City: Mannheim
Published: 14.06.2010