Module Module1

    Sub ShellSort(ByVal pole() As String, ByVal pocetPrvku As Integer)
        'Procedura ShellSort radi prvky pole pole() ve vzestupnem
        'poradi a vraci jej volajici procedure.

        Dim temp As String
        Dim i, j, span As Integer

        span = pocetPrvku \ 2
        Do While span > 0
            For i = span To pocetPrvku - 1
                For j = (i - span) To 0 Step -span
                    If pole(j) <= pole(j + span) Then Exit For
                    'prehozeni tech prvku pole, ktere nejsou ve
                    'spravnem poradi
                    temp = pole(j)
                    pole(j) = pole(j + span)
                    pole(j + span) = temp
                Next j
            Next i
            span = span \ 2
        Loop
    End Sub

End Module
