瑞星卡卡安全论坛技术交流区系统软件 VB代码 请大家帮我详细解答一下

1   1  /  1  页   跳转

VB代码 请大家帮我详细解答一下

VB代码 请大家帮我详细解答一下


    Sub ShellSort(ByRef sort() As String, ByVal numOfElements As Short)
        Dim temp As String
        Dim i, j, span As Short
        'The ShellSort procedure sorts the elements of sort()
        'array in descending order and returns it to the calling
        'procedure.

        span = numOfElements \ 2
        Do While span > 0
            For i = span To numOfElements - 1
                For j = (i - span + 1) To 1 Step -span
                    If sort(j) <= sort(j + span) Then Exit For
                    'swap array elements that are out of order
                    temp = sort(j)
                    sort(j) = sort(j + span)
                    sort(j + span) = temp
                Next j
            Next i
            span = span \ 2
        Loop
    End Sub
最后编辑2006-07-16 20:31:36
分享到:
gototop
 

能多详细就多详细
gototop
 
1   1  /  1  页   跳转
页面顶部
Powered by Discuz!NT