Skip to content

Instantly share code, notes, and snippets.

@mvoitko
Last active October 2, 2020 12:02
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 mvoitko/a7ea5585cc42dc2978d5b97218f5e221 to your computer and use it in GitHub Desktop.
Save mvoitko/a7ea5585cc42dc2978d5b97218f5e221 to your computer and use it in GitHub Desktop.
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