#3033. [GESP202309 四级 C++] 第 15 题

[GESP202309 四级 C++] 第 15 题

在下列代码的横线处填写( ),完成对有 nint 类型元素的数组 array 由小到大排序。

void BubbleSort(int array[], int n) {
    for (int i = n; i >= 2; i--)
        for (_______________) // 在此处填入代码
            if (array[j] > array[j + 1]) {
                int t = array[j];
                array[j] = array[j + 1];
                array[j + 1] = t;
            }
}

{{ select(1) }}

  • int j = 1; j < n; j++
  • int j = 0; j < n; j++
  • int j = 0; j < i - 1; j++
  • int j = 0; j < i; j++