#include <stdio.h>
void dataPrint(int *a, int n)
{
int i;
for ( i = 0; i < 7; i++) {
}
}
int shuttle_sort(int num[], int n)
{
int i, j, k, tmp;
for (i = 1; i < n; i++) { /* 配列の先頭の2つ目から */
tmp = num[i]; /* スキャンしたデータを別の変数に保管し、「挿入するデータ」と定義する */
k = i; /* 挿入位置を変数kに保存 */
for (j = i; j > 0; j--) {
if (num[j - 1] > tmp) { /* 「現在着目しているデータ」> 「挿入するデータ」の場合 */
num[j] = num[j - 1];
k = j - 1; /* データの代入が有った場合だけ、挿入位置を更新 */
}
}
num[k] = tmp; /* データを挿入 */
dataPrint(num, n);
}
return 0;
}
int main()
{
int i, data[7];
for ( i = 0; i < 7; i++) {
}
dataPrint(data, 7);
shuttle_sort(data, 7);
dataPrint(data, 7);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGRhdGFQcmludChpbnQgKmEsIGludCBuKQp7CiAgaW50IGk7CgogIGZvciAoIGkgPSAwOyBpIDwgNzsgaSsrKSB7CiAgICBwcmludGYoIiUzZCIsIGFbaV0pOwogIH0KICBwcmludGYoIlxuIik7Cn0KCmludCBzaHV0dGxlX3NvcnQoaW50IG51bVtdLCBpbnQgbikKewogIGludCBpLCBqLCBrLCB0bXA7CgogIGZvciAoaSA9IDE7IGkgPCBuOyBpKyspIHsgICAgLyog6YWN5YiX44Gu5YWI6aCt44GuMuOBpOebruOBi+OCiSAqLwogICAgdG1wID0gbnVtW2ldOyAgICAgICAgICAgICAgIC8qIOOCueOCreODo+ODs+OBl+OBn+ODh+ODvOOCv+OCkuWIpeOBruWkieaVsOOBq+S/neeuoeOBl+OAgeOAjOaMv+WFpeOBmeOCi+ODh+ODvOOCv+OAjeOBqOWumue+qeOBmeOCiyAqLwogICAgayA9IGk7CSAgICAgICAgICAgICAgICAvKiDmjL/lhaXkvY3nva7jgpLlpInmlbBr44Gr5L+d5a2YICovCiAgICBmb3IgKGogPSBpOyBqID4gMDsgai0tKSB7CiAgICAgIGlmIChudW1baiAtIDFdID4gdG1wKSB7ICAgLyog44CM54++5Zyo552A55uu44GX44Gm44GE44KL44OH44O844K/44CNPiDjgIzmjL/lhaXjgZnjgovjg4fjg7zjgr/jgI3jga7loLTlkIggKi8KICAgICAgICBudW1bal0gPSBudW1baiAtIDFdOwogICAgICAgIGsgPSBqIC0gMTsgICAgICAgICAgICAgIC8qIOODh+ODvOOCv+OBruS7o+WFpeOBjOacieOBo+OBn+WgtOWQiOOBoOOBkeOAgeaMv+WFpeS9jee9ruOCkuabtOaWsCAqLwogICAgICB9CiAgICB9CiAgICBudW1ba10gPSB0bXA7CQkvKiDjg4fjg7zjgr/jgpLmjL/lhaUgKi8KICAgIHByaW50ZigiJWQg5Zue55uu77yaIiwgaSk7CiAgICBkYXRhUHJpbnQobnVtLCBuKTsKICB9CiAgcmV0dXJuIDA7Cn0KCmludCBtYWluKCkKewogIGludCBpLCBkYXRhWzddOwoKICBwcmludGYoIjfkurrjga7ngrnmlbDjgpLlhaXlipvjgZfjgabkuIvjgZXjgYRcbiIpOwogIGZvciAoIGkgPSAwOyBpIDwgNzsgaSsrKSB7CiAgICBzY2FuZigiJWQiLCAmZGF0YVtpXSk7CiAgfQogIHByaW50Zigi5pW05YiX5YmN77yaIik7CiAgZGF0YVByaW50KGRhdGEsIDcpOwogIHNodXR0bGVfc29ydChkYXRhLCA3KTsKICBwcmludGYoIuaVtOWIl+W+jO+8miIpOwogIGRhdGFQcmludChkYXRhLCA3KTsKCiAgcmV0dXJuIDA7Cn0K