irgendwie funz mein sectionsort algorithmus nich und es entsteht auch immer eine arrayindexoutofboundsexeption... wo ist der fehler??
Java:
public void selectionsort(int[] reihe){
int asdf = reihe.length;
while (asdf>=0){
int maxZahl = 0;
//suche größte zahl
for (int i=1; i<asdf;i++){
if(reihe[i] > reihe[maxZahl]){
maxZahl = i;
}
}
//tauschen
int temp = reihe[asdf];
reihe[asdf] = maxZahl;
maxZahl = temp;
asdf--;
}
}
}
Zuletzt bearbeitet von einem Moderator: