Created
May 9, 2017 04:57
-
-
Save gamalielhere/e0dbacd79181a64a684d4e8ed8f7ada3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void selectionSort (int array[], int size) { | |
int startScan, minIndex, minValue; | |
for(startScan = 0; startScan < (size - 1); startScan++) { | |
minIndex = startScan; | |
minValue = array[startScan]; | |
for(int index = startScan + 1; index < size; index++) { | |
if(array[index] < minValue) { | |
minValue = array[index]; | |
minIndex = index; | |
} | |
} | |
array[minIndex] = array[startScan]; | |
array[startScan] = minValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment