Tschuldigt, dass das alles auf Englisch ist, hab das auf mehreren Seiten gepostet aber noch keine Hilfe bekommen 
Ich hab das Programm mit der Hilfe der Seite How do we Partition? gemacht, wenn irgendwer mir helfen könnte wäre ich darüber sehr froh.
quicksort() is getting started the first time with the values 0 for first and 99 for last. An array 100 units long, filled with 3-9 letters should be sorted, b.umwandeln() just declares the value of the unit, there's no error there.
I don't know, why I get so many errors, and why it sometimes works perfectly. The array is always filled with random letters.
Ich hab das Programm mit der Hilfe der Seite How do we Partition? gemacht, wenn irgendwer mir helfen könnte wäre ich darüber sehr froh.
quicksort() is getting started the first time with the values 0 for first and 99 for last. An array 100 units long, filled with 3-9 letters should be sorted, b.umwandeln() just declares the value of the unit, there's no error there.
I don't know, why I get so many errors, and why it sometimes works perfectly. The array is always filled with random letters.
Java:
public void quicksort(int first, int last){
if (b.umwandeln(wertqs[first])<=b.umwandeln(wertqs[last])) {
pivot = partition(first, last);
this.quicksort(first, pivot-1);
this.quicksort(pivot+1, last);
} else {
if (pel==0) {
if (b.umwandeln(wertqs[first])>b.umwandeln(wertqs[last])) {
String help = wertqs[first];
wertqs[first] = wertqs[last];
wertqs[last] = help;
pel=1;
quicksort(first, last);
} // end of if
} // end of if
} // end of if-else
}
public int partition(int first, int last){
int pivot1 = first;
int up = first;
int down = last;
for (int p=0;p<1;p=p) {
while (b.umwandeln(wertqs[up])<=b.umwandeln(wertqs[pivot1])) {
up=up+1;
} // end of while
while (b.umwandeln(wertqs[down])>b.umwandeln(wertqs[pivot1])) {
down=down-1;
} // end of while
if (up<down) {
String help2 = wertqs[up];
wertqs[up] = wertqs[down];
wertqs[down] = help2;
} else {
p=1;
} // end of if-else
} // end of for
String help3=wertqs[first];
wertqs[first]=wertqs[down];
wertqs[down]=help3;
pivot1 = down;
return pivot1;
}
Zuletzt bearbeitet: