Skip to content

Instantly share code, notes, and snippets.

@Nata01
Last active December 7, 2015 22:13
Show Gist options
  • Save Nata01/2fc9806885eafb0d12dd to your computer and use it in GitHub Desktop.
Save Nata01/2fc9806885eafb0d12dd to your computer and use it in GitHub Desktop.
Bubble sort
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