master
parent
b142516902
commit
ede9eb44fd
|
@ -24,17 +24,16 @@ public class InsertionSort
|
||||||
}
|
}
|
||||||
//Vergleichen und Vertauschen
|
//Vergleichen und Vertauschen
|
||||||
System.out.println("Sortierter Array:");
|
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 Wert = Array[i];
|
||||||
int j = i -1 ;
|
int j = i -1 ;
|
||||||
while(j >= 0 && Array[j] >Wert ){
|
while(Array[j] > Wert){
|
||||||
Array [j] = Array[j + 1];
|
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();
|
System.out.println();
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ public class InsertionSort
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
public class __SHELL37 extends bluej.runtime.Shell {
|
public class __SHELL15 extends bluej.runtime.Shell {
|
||||||
public static void run() throws Throwable {
|
public static void run() throws Throwable {
|
||||||
|
|
||||||
InsertionSort.InsertionSort();
|
InsertionSort.InsertionSort();
|
Loading…
Reference in New Issue