Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SelectionSort
- {
- // Instanzvariablen - ersetzen Sie das folgende Beispiel mit Ihren Variablen
- int [] A = new int[] {8,15,3,12,9,7};
- int n = A.length;
- int links, min, i;
- /**
- * Konstruktor für Objekte der Klasse SelectionSort
- */
- public SelectionSort()
- {
- // Instanzvariable initialisieren
- while (links < n)
- {
- min = links;
- for(int i = links + 1 ;i < A.length; i++)
- {
- if( A[i] < A[min])
- {
- min = i;
- }
- }
- int Hilfe = A[i];
- A[i] = A[min];
- A[min]= Hilfe;
- links = links + 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement