有数组a,其奇数下标的元素是降序排序的奇数,偶数下标的元素是降序排序的偶数,依据对分查找思想,设计一个在数组a中查找数据key的程序。部分程序段如下:
Key = Val(Text1.Text)
i = 1: j = 10: flag = False
Do While
m = Int((i + j) / 2 + 0.5)
If Then m = m - 1
If a(m) = Key Then
flag = True
ElseIf Then
i = m + 2
Else
j = m - 2
End If
Loop
If Not flag Then
Text2.Text = "查无数据"
Else
Text2.Text = "该数位置为" + Str(m)
End If
方框①②③中的代码依次为( )
- A、①i <= j And Not flag ②Key Mod 2 + a(m) Mod 2 = 1 ③a(m) > Key
- B、①i <= j And Not flag ②Key Mod 2 <> a(m) Mod 2 ③a(m) < Key
- C、①i <= j Or Not flag ②Key Mod 2 + a(m) Mod 2 = 1 ③a(m) > Key
- D、①i <= j Or Not flag ②Key Mod 2 <> a(m) Mod 2 ③a(m) < Key