D. 冒泡排序procedure bubble_sort;var i,j,k:integer;

D. 冒泡排序

procedure bubble_sort;

var i,j,k:integer;


相关考题:

当Form1_Click事件发生时,窗体上显示的第三行是( )。 Option Base 1 Private Sub Form_Click() Dim i As Integer,j As Integer Dim k As Integer,a(5,5)As Integer For i=1 To 5 k=1 For j=1 To 5 If i<=j Then a(i,j)=k k=k+1 Else a(i,j)=1 End If Next j Next i For i=1 To 5 For j=1 To 5 Print a(i,j); Next j Print Next i End SubA.1 2 3 4 5B.1 1 2 3 4C.1 1 1 2 3D.1 1 1 1 2

阅读下列程序: Private Sub Command1_Click( ) Dim i As Integer,k As Integer k=2 For i=1 To 3 Print H(k); Next i End Sub Function H(j As Integer) a=0 Static b a=a+1 b=b+1 H=a*b+j End Function 程序运行后,单击命令按钮输出结果是A.234B.345C.567D.356

在窗体上画一个名称为CoilTlilandl的命令按钮,然后编写如下事件过程: Private Sub command1 Click() Dim m As Integer, i As Integer, x(3)As Integer For i=0 To 3:x(i)=i:Next i For i = 1 To 2: Call sub1(x,i):Next i For i = 0 To 3: Print x(i);: Next i End Sub Private Sub sub1(a()As Integer,k As Integer) Dim i As Integer Do a(k)=a(k)+a(k+1) j = j + 1 Loop While j < 2 End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是A.0 3 7 5B.0 1 2 3C.3 2 4 5D.0 5 8 3

23 有如下程序段,该程序段循环的次数是______。 Dim i As Integer Dim j As Integer Dim k As Integer k=0 For i = 0 To 10 Step 3 For j = 1 To 5 If j > 3 Then k = k + 4: Exit For k=k+1 Print k Next j If i > 8 Then Exit For Next iA.9B.10C.11D.12

阅读下列程序。 Private Sub Command1_Click() Dim i As Integer,k As Integer k=2 For i=1 To 3 Print Fun(k); Next End Sub Function Fun(j As Integer) Static b a=0 a=a + 1 b=b + 1 Fun=a*b+j End Function 程序运行后,单击命令按钮输出结果是A.234B.345C.567D.356

最小生成树A.Prim算法:procedure prim(v0:integer);varlowcost,closest:array[1..maxn] of integer;i,j,k,min:integer;

四、排序算法A.快速排序:procedure qsort(l,r:integer);var i,j,mid:integer;

B.插入排序:思路:当前a[1]..a[i-1]已排好序了,现要插入a[i]使a[1]..a[i]有序。procedure insert_sort;var i,j:integer;

C.选择排序:procedure sort;var i,j,k:integer;

E.堆排序:procedure sift(i,m:integer);{调整以i为根的子树成为堆,m为结点总数}var k:integer;

F. 归并排序{a为序列表,tmp为辅助数组}procedure merge(var a:listtype; p,q,r:integer);{将已排序好的子序列a[p..q]与a[q+1..r]合并为有序的tmp[p..r]}var I,j,t:integer;tmp:listtype;

高精度数的定义:typehp=array[1..maxlen] of integer;1.高精度加法procedure plus ( a,b:hp; var c:hp);var i,len:integer;

高精度减法procedure substract(a,b:hp;var c:hp);var i,len:integer;

高精度乘以低精度procedure multiply(a:hp;b:longint;var c:hp);var i,len:integer;

高精度乘以高精度procedure high_multiply(a,b:hp; var c:hp}var i,j,len:integer;

高精度除以低精度procedure devide(a:hp;b:longint; var c:hp; var d:longint);{c:=a div b; d:= a mod b}var i,len:integer;

已知前序中序求后序procedure Solve(pre,mid:string);var i:integer;

n皇后问题procedure try(i:byte);var j:byte;

链表的定位函数loc(I:integer):pointer; {寻找链表中的第I个结点的指针}procedure loc(L:linklist; I:integer):pointer;var p:pointer;j:integer;

单链表的插入操作procedure insert(L:linklist; I:integer; x:datatype);var p,q:pointer;

单链表的删除操作procedure delete(L:linklist; I:integer);var p,q:pointer;

当Form_Click;事件发生时,窗体上显示的第三行是 ______。 Private Sub Form_Click() Dim i As Integer, j As Integer, k As Integer Dim x(5, 5) As Integer For i = 1 To 5 k = 1 For j = 1 To 5 If i <= j Then x(i, j) = k + 1 k=k+2 Else x(i, j) = k + 1 End If Next j Next i For i = 1 To 5 For j = 1 To 5 Print x(i, j) Next j Print Next i End SubA.22135B.21357C.22213D.13579

下面程序运行后的结果是( )。 Private Sub Form_Click() Dim s As Integer,k As Integer,i As Integer,n As Integer s=1 fori=1 to 3 forj=i to 3 for k=j to istep-1 s=s*k nextk,J,i print s End SubA.6B.72C.144D.432

在窗体上画一个按钮,然后编写如下的事件代码。在按钮上单击,输出为( )。 Private Function fun(x As Integer,y As Integer) Static m As Integer Static i As Integer i=i+2 i=i+m+1 m=i+x+y fun=m End Function Private Sub Command1_Click() Dim j As Integer,m As Integer,k As Integer j=4:m=1 k=fun(j,m) Print k; k=fun (j,m) Print k End SubA.8 18B.7 17C.7 19D.8 19

在下列程序中:Program test(input, output);var i. j:integer;procedure calc(p1, p2: integer);beginp2: = p2 * p2 p1: = p1 - p2; p2: = p2 - p1; end {caic}begin {main} i: =2;j:=3;calc(i,j); write(j);end {main}当参数传递采用引用方式(Call by reference)时,所得结果j=(6);当参数传递采用换名方式(Call by name)时,所得结果,j=(7);当参数传递采用赋值方式(Call by value)时,所得结果,j=(8)。A.3B.6C.10D.16

当发生Form_Click事件时,窗体上显示的第三行是( )。 Option Base 1 Private Sub Form_Click() Dim i As Integer,j As Integer,k As Integer Dim a(5,5)As Integer For i=1 To 5 k=1 For i=1 To 5 If(i<=j)Then a(i,j)=k k=k+2 Else a(i,j)=k+1 End If Next j Next i For i=1 To 5 For j=1 To 5 Print a(i,j); Next j Print Next i End SubA.1 3 5 7 9B.2 1 3 5 7C.2 2 2 1 3D.2 2 1 3 5

下列程序段的执行结果为 ______。 Dim m(3,3)As Integer Dim i As Integer Dim j As Integer Dim K As Integer For i=1 To 3 m(i,i)=i Next For i=0 To 3 For j=0 To 3 x=x+m(i,j) Next Next Print xA.3B.4C.5D.6