单选题

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

void BubbleSort(int array[], int n) { for (int i = n; i > 1; i--)

for ( ) // 在此处填入代码

if (array[j] > array[j + 1]) { int t = array[j];

array[j] = array[j + 1]; array[j + 1] = t;

}

}

A

int j = i ?2; j >= 0; j--

B

int j = i - 1; j >= 0; j--

C

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

D

int j = 0; j < i; j++

赣ICP备20007335号-2