Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
fun quicksort [] = []
|
||||
| quicksort (x::xs) =
|
||||
let
|
||||
val (left, right) = List.partition (fn y => y<x) xs
|
||||
in
|
||||
quicksort left @ [x] @ quicksort right
|
||||
end
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
fun par_helper([], x, l, r) = (l, r)
|
||||
| par_helper(h::t, x, l, r) =
|
||||
if h <= x then
|
||||
par_helper(t, x, l @ [h], r)
|
||||
else
|
||||
par_helper(t, x, l, r @ [h]);
|
||||
|
||||
fun par(l, x) = par_helper(l, x, [], []);
|
||||
|
||||
fun quicksort [] = []
|
||||
| quicksort (h::t) =
|
||||
let
|
||||
val (left, right) = par(t, h)
|
||||
in
|
||||
quicksort left @ [h] @ quicksort right
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue