Auswahl sortieren:Selection Sort Algorithmus
Ich habe eine Auswahl Sortier-Algorithmus erstellt, aber jemand sagte mir seine nicht richtige Auswahl sortieren.
Wenn es nicht richtig ist, welche Art von Sortierung ist es? und wie unterscheidet es sich dann von der Sortierung nach Auswahl.
Code:
void selection_Sort(int arr[] , int size){
int temp , length = size;
for(int i = 0; i < size ; i++){
for(int j = i + 1; j < size ; j++){
if(arr[i] > arr[j]){
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}
}
}
Bitte sagen Sie mir, wie kann ich es verbessern?
Auswahl sortieren ist ziemlich gut erklärt auf https://en.wikipedia.org/wiki/Selection_sort#Implementation. Code-Snippet auf der Seite. – Spade