Skip to content

Instantly share code, notes, and snippets.

public class SelectionSort {
private static int[] selectionSort(int[] values) {
for(int firstUnsortedIndex = 0;
firstUnsortedIndex < values.length;
firstUnsortedIndex++) {
swapValuesAt(values,
firstUnsortedIndex,
findIndexOfSmallestValueAfter(values, firstUnsortedIndex));
}