Created
July 13, 2016 08:04
-
-
Save mitulmanish/1feb8b10e482b26567f58a7cee0309d7 to your computer and use it in GitHub Desktop.
Bubble Sort
This file contains hidden or 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
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