DIM Stacksize As Longdim Top As longconst lowPosition as integer = 0const highposition as integer = 1
Function QuickSortnonRecursion (Byref Listtosort () As Boolean Dim Stack (100, 2) As Long Dim Low As Long, Temphigh As Long :::::: LOW = (LBound) )): high = (Ubound (Listtosort)) Dim PlaceMeright As Long, ExchangeTemp As Long Stack: Stack (Top, HighPosition) = High While (TOP> = 0) PlaceMeright = Listtosort (Stack " , LowPosition) "Low = stack (top, lowposition) high = stack (top, highposition) Do do while (list, lowposition)
low stack (top, HighPosition) = tempHigh End If WendEnd FunctionFunction bubbleSort (ByRef listToSort () As Long) As Boolean Dim i As Long, j As Long, endOfList As Long, exchangeTemp As Long endOfList = UBound (listToSort) For i = LBound (listtosort) to endoflist for j = I to endoflist if (Listtosort (i)> listtosort (j)) THEN ExchangeTemp = Listtosort (i) Listtosort (i) = listtosort (j) Listtosort (j) = ExchangeTemp end if next j Next iEnd FunctionPrivate Sub Class_Initialize () stackSize = 90: top = 0 End subFunction quickSortRecursion (ByRef listToSort () As Long, ByVal First As Long, ByVal Last As Long) As Boolean Dim low As Long, high As Long, placeMeRight As Long, exchangeTemp As long low = first: high = last placemeright = listtosort (low) do do while (listtosort (low) END FUNCTION