freverda 2022-11-12 17:45:42 +01:00
parent b142516902
commit ede9eb44fd
2 changed files with 7 additions and 8 deletions

View File

@ -24,17 +24,16 @@ public class InsertionSort
}
//Vergleichen und Vertauschen
System.out.println("Sortierter Array:");
for(int i = 0; i<Array.length; i++){
for(int i = 1; i<Array.length; i++){
int Wert = Array[i];
int j = i -1 ;
while(j >= 0 && Array[j] >Wert ){
Array [j] = Array[j + 1];
while(Array[j] > Wert){
Array [j + 1] = Array[j ];
System.out.println(Array[j+1] );
System.out.println(Array[j] );
}
while(j>=0 && Array[j] < Wert){
System.out.print(Array[i]);
}
System.out.println();
@ -46,7 +45,7 @@ public class InsertionSort
}
}

View File

@ -1,5 +1,5 @@
public class __SHELL37 extends bluej.runtime.Shell {
public class __SHELL15 extends bluej.runtime.Shell {
public static void run() throws Throwable {
InsertionSort.InsertionSort();