単純なソートはどれが一番単純か

主に行数的な意味で。
Javaで書いてみた。

private static void swap(int[] target, int index1, int index2) {
    int tmp = target[index1];
    target[index1] = target[index2];
    target[index2] = tmp;
}

// 挿入ソート
public static int[] insSort(int[] target) {
    for (int i = 0; i < target.length; i++) {
        for (int j = i; j != 0; j--) {
            if (target[j] < target[j - 1]) {
                swap(target, j, j - 1);
            } else {
                break;
            }
        }
    }
    return target;
}

// 選択ソート
public static int[] selSort(int[] target) {
    for (int i = 0; i < target.length; i++) {
        int minIndex = i;
        for (int j = i + 1; j < target.length; j++) {
            if (target[j] < target[minIndex]) {
                minIndex = j;
            }
        }
        swap(target, i, minIndex);
    }
    return target;
}

// バブルソート
public static int[] bblSort(int[] target) {
    for (int i = 0; i < target.length; i++) {
        for (int j = 0; j < target.length - i - 1; j++) {
            if (target[j + 1] < target[j]) {
                swap(target, j + 1, j);
            }
        }
    }
    return target;
}

// ビンソート
public static int[] binSort(int[] target, int max) {
    int[] bins = new int[max];
    for (int i : target) bins[i]++;
    for (int i = 0, crnt = 0; i < bins.length; i++) {
        while (bins[i]-- != 0) {
            target[crnt++] = i;
        }
    }
    return target;
}


どれもそんなにかわんないですね。
挿入ソートは効率を無視することでバブルソートと同じ行数に出来る。

public static int[] insSort(int[] target) {
    for (int i = 0; i < target.length; i++) {
        for (int j = i; j != 0; j--) {
            if (target[j] < target[j - 1]) {
                swap(target, j, j - 1);
            }
        }
    }
    return target;
}