I'm just new to Tailbite...
I'm trying to make an userlib from this procedure:
Code: Select all
ProcedureDLL QuickSort(Array a(1), g.l, d.l)
If g < d
v = a(d)
i = g-1
j = d
Repeat
Repeat
i=i+1
Until a(i) >= v
ok = 0
Repeat
If j>0
j=j-1
Else
ok=1
EndIf
If a(j) <= v
ok=1
EndIf
Until ok<>0
tmp.l = a(i)
a(i) = a(j)
a(j) = tmp
Until j <= i
t = a(j)
a(j) = a(i)
a(i) = a(d)
a(d) = t
QuickSort(a(), g, i-1)
QuickSort(a(), i+1, d)
EndIf
EndProcedure
Code: Select all
Dim teste(50)
teste(0) = 5
teste(1) = 2
teste(2) = 4
teste(3) = 3
teste(4) = 1
teste(5) = 6
QuickSort(teste(), 0,5) ;IMA
For a=0 To 5
Debug teste(a)
Next
I'm also too tired, maybe I'm missing something obvious, sorry if thats the case