VB Code:
Private Sub Quicksort(ByRef p_Array(), ByVal inLow As Long, ByVal inHi As Long)
Dim pivot
Dim tmpSwap
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) < pivot And tmpLow < inHi)
tmpLow = tmpLow + 1
Wend
While (pivot < p_Array(tmpHi) 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