当前位置: 高中信息技术 / 单选题
  • 1. (2020高三下·浙江月考) 数组a中存储了无序的数组元素,为了使a数组中的元素存储为左右交替上升,小赵依据选择排序思想设计了如下VB程序算法,为了实现上述功能,划线处应填入的代码为(  )

    L = 1: R = n

    Do While L < R

    imin_1 = L: imin_2 = R

        For i = L + 1 To R

            If a(i) < a(imin_1) Then

               imin_2 = imin_1

               imin_1 = i

            ElseIf a(i) < a(imin_2) Then

               imin_2 = i

            End If

        Next i

        If imin_1 <> L Then t = a(imin_1): a(imin_1) = a(L): a(L) = t

        ____________________

        If imin_2 <> R Then t = a(imin_2): a(imin_2) = a(R): a(R) = t

        L = L + 1: R = R - 1

    Loop

    A . If imin_1 = L Then imin_1 = imin_2     B . If imin_1 = L Then imin_2 = imin_1 C . If imin_2 = L Then imin_1 = imin_2   D . If imin_2 = L Then imin_2 = imin_1

微信扫码预览、分享更方便