Tuesday, September 20, 2011 - 0 comments

[Sorting] Shell Short

nih gan.. ane baru aja bikin project tentang Sorting metoda... Kali ini ane post sorting dengan metode "Shell Sort" di VB.net

--------------------------------------------------
Sub ShellShort()
        Dim G, F, X, C As Integer
        G = N \ 2
        While G > 0
            Do

                F = 0
                For X = 1 To N - G
                    If AR(X) < AR(X + G) Then
                        C = AR(X)
                        AR(X) = AR(X + G)
                        AR(X + G) = C
                        F = 1
                    End If
                Next X
            Loop Until F = 0
            G = G \ 2
        End While
    End Sub

-------------------------------------------------------

Download contoh program

0 comments:

Post a Comment