Last active
February 19, 2017 14:22
-
-
Save nyoronzoi/eb40a382debd6d36b61b1fbaca0008ca 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 class SelectionSort { | |
public int[] sort(int[] numbers) { | |
int size = numbers.length; | |
for (int i = 0; i < size; i++) { | |
int min = numbers[i]; | |
for (int j = i; j < size; j++) { | |
if (min > numbers[j]) { | |
int tmp = min; | |
min = numbers[j]; | |
numbers[j] = tmp; | |
} | |
numbers[i] = min; | |
} | |
} | |
return numbers; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
選択ソート