# select_sort # 配列 a[0] 〜 a[n-1] に n 個の数値データが入っているのを整列させる # 使用例: select_sort(n, a) function select_sort(n, a, i, j, k, minimum) { for (i = 0; i < n-1; i++) { minimum = a[i] k = i for (j = i+1; j < n; j++) if (a[j] < minimum) { minimum = a[j] k = j } if (k != i) { a[k] = a[i] a[i] = minimum } } }