I got the QuickSort code from somewhere??
here is a quick example.
VB Code:
Private Type Descriptions strDesc As String strCode As String End Type Private Sub Quicksort(ByRef p_Array() As Descriptions, ByVal inLow As Long, ByVal inHi As Long) 'A version of the QuickSort Algorithm applied to the User Defined Data Type "Descriptions" Dim pivot As Descriptions Dim tmpSwap As Descriptions Dim tmpLow As Long Dim tmpHi As Long tmpLow = inLow tmpHi = inHi pivot = p_Array((inLow + inHi) \ 2) While (tmpLow <= tmpHi) While (p_Array(tmpLow).strDesc < pivot.strDesc And tmpLow < inHi) tmpLow = tmpLow + 1 Wend While (pivot.strDesc < p_Array(tmpHi).strDesc And tmpHi > inLow) tmpHi = tmpHi - 1 Wend If (tmpLow <= tmpHi) Then tmpSwap = p_Array(tmpLow) p_Array(tmpLow) = p_Array(tmpHi) p_Array(tmpHi) = tmpSwap tmpLow = tmpLow + 1 tmpHi = tmpHi - 1 End If Wend If (inLow < tmpHi) Then Quicksort p_Array, inLow, tmpHi If (tmpLow < inHi) Then Quicksort p_Array, tmpLow, inHi End Sub




Reply With Quote