Skip to content

Instantly share code, notes, and snippets.

@mitulmanish
Created July 13, 2016 08:04
Show Gist options
  • Save mitulmanish/1feb8b10e482b26567f58a7cee0309d7 to your computer and use it in GitHub Desktop.
Save mitulmanish/1feb8b10e482b26567f58a7cee0309d7 to your computer and use it in GitHub Desktop.
Bubble Sort
private static int [] bubbleSort(int [] numberSet) {
for (int i = 0; i < numberSet.length -1; i++) {
for (int j = i + 1; j < numberSet.length; j++) {
int localVar = i;
if (numberSet[localVar] > numberSet[j]) {
int temp = numberSet[i];
numberSet[i] = numberSet[j];
numberSet[j] = temp;
}
localVar++;
}
}
return numberSet;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment