下列VB程序功能为:先把数组中最小的元素放到中间位置,再把第二小的元素放到中间的后一个位置,然后把第三小的元素放到中间的前一个位置,以此类推。如数组元素a(1)到a(9)的值依次为72,61,3,95,39,38,64,65,98,程序运行后,数组元素a(1)到a(9)的值依次为98,72,64,39,3,38,61,65,95。
m = (1 + n) \ 2 ‘n为数组元素的个数,m为数组中间位置元素的下标
For i = 1 To n
If a(i) < a(m) Then t = a(i): a(i) = a(m): a(m) = t
Next i
p = m: q = m
For i = 1 To n - 2
If i Mod 2 = 1 Then
k = q + 1: q = q + 1
Else
k = p - 1: p = p - 1
End If
pos = k
For j = 1 To n
If And a(j) < a(k) Then k = j
Next j
If pos > k Then
t = a(pos): a(pos) = a(k): a(k) = t
End If
Next i
上述程序段方框处的代码为( )