Skip to content

Instantly share code, notes, and snippets.

@mvoitko
Last active Oct 2, 2020
Embed
What would you like to do?
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