Last active
October 2, 2020 12:02
-
-
Save mvoitko/a7ea5585cc42dc2978d5b97218f5e221 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 bubbleSort(int[] a) | |
{ | |
int n = a.length; | |
for (int j = 0; j < n - 1; ++j) | |
{ | |
for (int i = 0; i < n - j - 1; ++i) | |
{ | |
if (a[i] > a[i+1]) | |
{ | |
swap(a, i, i+1); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment