Skip to content

Instantly share code, notes, and snippets.

@1RodrigoSoares
Created June 13, 2023 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1RodrigoSoares/e69d4f7ab24e4d033523a0acf69b0461 to your computer and use it in GitHub Desktop.
Save 1RodrigoSoares/e69d4f7ab24e4d033523a0acf69b0461 to your computer and use it in GitHub Desktop.
BubbleSort
void bubbleSort(int array[], int size) {
for (int i = 0; i < size - 1; i++) {
for (int j = 0; j < size - i - 1; j++) {
if (array[j] > array[j + 1]) {
int temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment