Manage Learn to apply best practices and optimize your operations.

Shell-Metzner Sort

Here is one of the fastest algorithm to sort a array !
This is the SHELL-METZNER sort.

Just take a look at the code below.
Tablo() is an array of string
n is the number of element in this array

Test it and compare it to other method, this the faster one !
Sub TriSM(Tablo() As String, n As Integer)

Dim done As Variant
Dim Jump, i, j As Integer
Dim inter As String

Jump = n

While Jump > 1

Jump = Jump \ 2

Do
done = True
For j = 1 To n - Jump
i = j + Jump

If Tablo(j) > Tablo(i) Then

inter = Tablo(i)
Tablo(i) = Tablo(j)
Tablo(j) = inter

done = False

End If

Next

Loop Until done

Wend

End Sub

Dig Deeper on Domino Resources - Part 5

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close