Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
fn quickSort arr =
|
||||
(
|
||||
less = #()
|
||||
pivotList = #()
|
||||
more = #()
|
||||
if arr.count <= 1 then
|
||||
(
|
||||
arr
|
||||
)
|
||||
else
|
||||
(
|
||||
pivot = arr[arr.count/2]
|
||||
for i in arr do
|
||||
(
|
||||
case of
|
||||
(
|
||||
(i < pivot): (append less i)
|
||||
(i == pivot): (append pivotList i)
|
||||
(i > pivot): (append more i)
|
||||
)
|
||||
)
|
||||
less = quickSort less
|
||||
more = quickSort more
|
||||
less + pivotList + more
|
||||
)
|
||||
)
|
||||
a = #(4, 89, -3, 42, 5, 0, 2, 889)
|
||||
a = quickSort a
|
||||
Loading…
Add table
Add a link
Reference in a new issue