Created
October 26, 2019 08:19
-
-
Save yaboong/ee8d1a929d7a012d661aa2bda62ec744 to your computer and use it in GitHub Desktop.
This file contains 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
public static void sort(Integer[] a) { | |
int swapCount; | |
do { | |
swapCount = 0; | |
for (int i=1; i<a.length; i++) { | |
if (a[i-1] > a[i]) { | |
swap(a, i-1, i); | |
swapCount++; | |
} | |
} | |
} while (swapCount != 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment