Skip to content

Instantly share code, notes, and snippets.

@nyoronzoi
Last active February 19, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyoronzoi/eb40a382debd6d36b61b1fbaca0008ca to your computer and use it in GitHub Desktop.
Save nyoronzoi/eb40a382debd6d36b61b1fbaca0008ca to your computer and use it in GitHub Desktop.
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;
 }
}
@nyoronzoi
Copy link
Author

選択ソート

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment