'读取n个整数,依次存入a(1)到a(n)中,代码略
For i=1 To n - 1
For j=n To i+ 1 Step -l
If a(j)>a(j-1)Then t=a(j):a(j)=a(j-1):a(j-1)=t
Next j
Next i
执行上述程序段,下列说法正确的是( )
A.交换过位置的数据,可能会再回到其初始位置 |
B.执行完成后,数组元素a(1)到a(n)从小到大排列 |
C.若n为5,整个排序过程总的比较次数是20 |
D.整个排序过程总的交换次数至少为1 |
同类型试题
y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2
y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2