vorbereitung
parent
78557e8b60
commit
cdeda87bcd
|
|
@ -26,6 +26,18 @@ public class SortAlgo {
|
||||||
int[] erg3 = insertionsort(insert);
|
int[] erg3 = insertionsort(insert);
|
||||||
for (int i = 0; i < erg3.length;i++)
|
for (int i = 0; i < erg3.length;i++)
|
||||||
System.out.print(erg3[i] + " ");
|
System.out.print(erg3[i] + " ");
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
int[] erg4 = mergesort(insert);
|
||||||
|
for (int i = 0; i < erg4.length;i++)
|
||||||
|
System.out.print(erg4[i] + " ");
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
int[] erg5 = quicksort(insert);
|
||||||
|
for (int i = 0; i < erg5.length;i++)
|
||||||
|
System.out.print(erg5[i] + " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int[] bubblesort (int[] arr) {
|
public static int[] bubblesort (int[] arr) {
|
||||||
|
|
@ -82,4 +94,14 @@ public class SortAlgo {
|
||||||
log.info("Anzahl der Durchläufe: " + d);
|
log.info("Anzahl der Durchläufe: " + d);
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int[] mergesort (int[] arr) { // O(n*log2(n))
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] quicksort (int[] arr) { // durchschnitt: O(n*log2(n))
|
||||||
|
// worst case : O(n^2)
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ public class Tabelle {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bestCase worstCase
|
// bestCase worstCase
|
||||||
//Bubblesort O(n^2) O(n^2)
|
//Bubblesort O(n) O(n^2)
|
||||||
//Selectionsort O(n) O(n^2)
|
//Selectionsort O(n^2) O(n^2)
|
||||||
//Insertionsort O(n) O(n^2)
|
//Insertionsort O(n) O(n^2)
|
||||||
|
|
||||||
//Zur Klärung der "Sockenfrage" berechnen Sie die Anzahl der Vergleiche für gute (n log n)!!! und
|
//Zur Klärung der "Sockenfrage" berechnen Sie die Anzahl der Vergleiche für gute (n log n)!!! und
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue