12.11.
							parent
							
								
									b39587b4d5
								
							
						
					
					
						commit
						b142516902
					
				|  | @ -20,18 +20,23 @@ public class InsertionSort | |||
|       //Array ausgeben
 | ||||
|       System.out.println("Array:"); | ||||
|      for(int i = 0; i<Array.length; i++){ | ||||
|         System.out.println(+Array[i]); | ||||
|         System.out.println(Array[i]); | ||||
|         } | ||||
|         //Vergleichen und Vertauschen
 | ||||
|         System.out.println("Sortierter Array:"); | ||||
|         for(int i = 0; i<Array.length; i++){ | ||||
|         int ArrayToSort = Array[i]; | ||||
|         int j = i; | ||||
|         while(ArrayToSort < Array[j+1]){ | ||||
|         Array[j] = Array[j-1]; | ||||
|        for(int i = 0; i<Array.length; i++){ | ||||
|         int Wert = Array[i]; | ||||
|         int j = i -1 ; | ||||
|         while(j >= 0 && Array[j] >Wert ){ | ||||
|         Array [j] = Array[j + 1]; | ||||
|          | ||||
|         System.out.println(Array[j+1] ); | ||||
|          | ||||
|         } | ||||
|         Array[j] = ArrayToSort; | ||||
|         System.out.println(ArrayToSort); | ||||
|         while(j>=0 && Array[j] < Wert){ | ||||
|         System.out.print(Array[i]); | ||||
|         } | ||||
|         System.out.println(); | ||||
|          | ||||
|         } | ||||
|          | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| 
 | ||||
| public class __SHELL11 extends bluej.runtime.Shell { | ||||
| public class __SHELL37 extends bluej.runtime.Shell { | ||||
| public static void run() throws Throwable { | ||||
| 
 | ||||
| InsertionSort.InsertionSort(); | ||||
		Loading…
	
		Reference in New Issue