Zu dieser Karteikarte gibt es einen kompletten Satz an Karteikarten. Kostenlos!
9
Quick Sort
private void quicksort (int [] a, int links, int rechts)
{
int i=links;
int j=rechts;
int mitte =a[(links+rechts)/2];
while (i<=j) {
while (a[i]< mitte) i;
while (a[j]>mitte) j;
if (i<=j) {
swap(a, i, j);
i ;
j ;
}
}
if (links<j) quicksort(a, links, j);
if (i<rechts) quicksort(a, i, rechts);
}
{
int i=links;
int j=rechts;
int mitte =a[(links+rechts)/2];
while (i<=j) {
while (a[i]< mitte) i;
while (a[j]>mitte) j;
if (i<=j) {
swap(a, i, j);
i ;
j ;
}
}
if (links<j) quicksort(a, links, j);
if (i<rechts) quicksort(a, i, rechts);
}

Karteninfo:
Autor: hristiana86
Oberthema: Informatik
Schule / Uni: HS
Ort: Mannheim
Veröffentlicht: 14.06.2010