Sorting algorithms/Quicksort: Difference between revisions
Content added Content deleted
(+Scheme) |
(added ocaml) |
||
Line 267: | Line 267: | ||
a = #(4, 89, -3, 42, 5, 0, 2, 889) |
a = #(4, 89, -3, 42, 5, 0, 2, 889) |
||
a = quickSort a |
a = quickSort a |
||
=={{header|OCaml}}== |
|||
let rec quicksort gt = function |
|||
| [] -> [] |
|||
| x::xs -> |
|||
let ys, zs = List.partition (gt x) xs in |
|||
quicksort gt ys @ x :: quicksort gt zs |
|||
let _ = |
|||
quicksort (>) [4; 65; 2; -31; 0; 99; 83; 782; 1] |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |