#3105. [GESP202406 四级 C++] 第 12 题

[GESP202406 四级 C++] 第 12 题

下面的排序算法程序中,横线处应该填入的是( )。

int a[8] = {2, 3, 4, 5, 6, 2, 3, 1};
for (int i = 1; i < 8; i++)
{

    int key = a[i];
    int j = i - 1;
    while (a[j] > key && j >= 0)
    {
        ___________;
        j -= 1;
    }
    a[j + 1] = key;
}

{{ select(1) }}

  • a[j] = a[j - 1]
  • a[j] = a[j + 1]
  • a[j + 1] = a[j - 1]
  • a[j + 1] = a[j]