Last active
December 7, 2015 22:13
-
-
Save Nata01/2fc9806885eafb0d12dd to your computer and use it in GitHub Desktop.
Bubble sort
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 bubbleSort(int *arr, int length){ | |
for(int i = 0; i < length; i++){ | |
for(int j = 0; j < length - 1 - i; j++){ | |
if(arr[j] > arr[j+1]){ | |
int temp = arr[j+1]; | |
arr[j+1] = arr[j]; | |
arr[j] = temp; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment