1 function quicksort(r
,s
)
2 if s
<=r
then return end -- caso basico da recursao
7 repeat i
=i
+1 until x
[i
]>=v
8 repeat j
=j
-1 until x
[j
]<=v
10 until j
<=i
-- separacao
11 x
[i
],x
[j
]=x
[j
],x
[i
] -- undo last swap
13 quicksort(r
,j
-1) -- recursao
21 n
=n
+1; x
[n
]="waldemar"
33 print(x
[0]..","..x
[1]..","..x
[2]..","..x
[3]..","..x
[4]..","..x
[5]..","..x
[6]..","..x
[7]..","..x
[8]..","..x
[9]..","..x
[10])
36 function sort(a
,n
) -- selection sort
42 if a
[j
]<a
[m
] then m
=j
end
45 a
[i
],a
[m
]=a
[m
],a
[i
] -- swap a[i] and a[m]