[LEGAL]
ShellSort

[CODE]
Public Sub CollectionSort_String_CS(ByRef xColl As Collection, ByRef DynAliasArray() As Long)
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xLong4 As Long
  Dim xChar1 As String
  Dim ElementsToSort As Long

  If Not xColl Is Nothing Then
    ElementsToSort = xColl.Count - 1&
    If Not ElementsToSort = -1& Then
      ReDim DynAliasArray(ElementsToSort)
      For xLong2 = 0& To ElementsToSort
        DynAliasArray(xLong2) = xLong2 + 1&
        Next
      Do
        xLong1 = 3& * xLong1 + 1&
        Loop Until xLong1 > ElementsToSort
      Do
        xLong1 = xLong1 \ 3&
        For xLong2 = xLong1 To ElementsToSort
          xChar1 = xColl(DynAliasArray(xLong2))
          xLong4 = DynAliasArray(xLong2)
          For xLong3 = xLong2 - xLong1 To 0& Step -xLong1
            If Not xColl(DynAliasArray(xLong3) > xChar1 Then Exit For
            DynAliasArray(xLong3 + xLong1) = DynAliasArray(xLong3)
            Next
          DynAliasArray(xLong3 + xLong1) = xLong4
          Next
        Loop While xLong1
      End If
    End If
  End Sub