下面是一段Pascal程序: for h:=1 to n-1 do begin x:=A[h+1]; k:=h; while(k>=1)and(A[k]>x)do begin A[k+1]:=A[k]; k:=k-1 end; A[k+1]:=x end; 假设在程序开始执行时,数组A[1…n)是一组随机整数。下列答案中,最好地描述了最差情况下的程序执行时间(运行时间阶数)的是
- AO(n log2n)
- BO(n)
- CO(log2n)
- DO(n2)
下面是一段Pascal程序: for h:=1 to n-1 do begin x:=A[h+1]; k:=h; while(k>=1)and(A[k]>x)do begin A[k+1]:=A[k]; k:=k-1 end; A[k+1]:=x end; 假设在程序开始执行时,数组A[1…n)是一组随机整数。下列答案中,最好地描述了最差情况下的程序执行时间(运行时间阶数)的是
1、Please arrange for the workers to do t
Please arrange for the workers to do the()work during loading the trucks and heavy cargo on the ship,and also supply the necessary materials for the work.AlashingBshiftingCliftingDtallying
2、下面程序运行时,输出的结果是() 5 A=0 10 FOR L=1 TO
下面程序运行时,输出的结果是()5 A=010 FOR L=1 TO 320 A=A+130 FOR J=1 TO L40 A=A+150 NEXT J60 A=A+170 NEXT L80 PRINT A90 ENDA3B12C9D6
3、假定有下面的程序段: For i=1 To 3 For j=1 To i F
假定有下面的程序段: For i=1 To 3 For j=1 To i For k=j To 3 Print"i=";i,"j=";j,"k=";k Next k Next j Next i 这是一个三重循环程序,在这个程序...
4、假定有以下程序段 n=0 for i=1 to 3 for j=-3 to
假定有以下程序段 n=0 for i=1 to 3 for j=-3 to 1 n=n+1 next j next i 运行完毕后,n的值是( )。A3B4C12D15
5、已知程序段:s = 0For i = 1 To 10 Step 2s =
已知程序段:s = 0For i = 1 To 10 Step 2s = s + 1i = i * 2Next i当循环结束后,变量i和s的值分别为______A10 4B11 3C22 3D16 4
6、下面程序段中循环语句的循环次数是()。 For x=10 To 1 Ste
下面程序段中循环语句的循环次数是()。For x=10 To 1 Step -3Write(x)Next xA0B4C5D10