Last active
October 26, 2015 23:19
-
-
Save jakecraige/f5d5a7c3c18b0a08d431 to your computer and use it in GitHub Desktop.
A sorting algorithm
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 sort(int values[], int n) | |
{ | |
for (int i = 0; i < n - 1; i++) | |
{ | |
int j = i + 1; | |
while (values[i] > values[j]) | |
{ | |
int temp = values[j]; | |
values[j] = values[i]; | |
values[i] = temp; | |
j++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anyone know if this is a defined sorting algorithm? I was going for bubble sort but this is definitely not it.