Skip to content

Instantly share code, notes, and snippets.

@mikamikuh
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save mikamikuh/bd55af048be20eb00431 to your computer and use it in GitHub Desktop.

Select an option

Save mikamikuh/bd55af048be20eb00431 to your computer and use it in GitHub Desktop.
BubbleSort
public void bubbleSort(int[] array) {
for (int i = array.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (array[j] > array[j + 1]) {
int n = array[j];
array[j] = array[j + 1];
array[j + 1] = n;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment