Der Algorithmus
void quicksort (int[] a) { int n=a.length; quicksort(a, 0, n-1); } void quicksort (int[] a, int lo, int hi) { int i=lo, j=hi; int x=a[(lo+hi)/2]; // Aufteilung while (i<=j) { while (a[i]x) j--; if (i<=j) { exchange(a,i, j); i++; j--; } } // Rekursion if (lo
int[] a = new int[] {1,42,5,23,6,5,34,52,911,2,31,4,100}; quicksort(a); display(a);
ausführen
Quelle: FH-Flensburg