Last active
September 30, 2023 09:34
-
-
Save begeekmyfriend/a05457d51ba0b8ebf4e04d92810482f3 to your computer and use it in GitHub Desktop.
This file contains 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 *nums, int size) | |
{ | |
int i, flag = size; | |
while (flag > 0) { | |
int len = flag; | |
flag = 0; | |
for (i = 1; i < len; i++) { | |
if (nums[i - 1] > nums[i]) { | |
int tmp = nums[i - 1]; | |
nums[i - 1] = nums[i]; | |
nums[i] = tmp; | |
flag = i; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment