Sorting algorithms/Quicksort: Difference between revisions
Content added Content deleted
No edit summary |
m (Switch to header template) |
||
Line 164: | Line 164: | ||
qsort (x:xs) = qsort ys ++ x : qsort zs where (ys, zs) = partition (<= x) xs |
qsort (x:xs) = qsort ys ++ x : qsort zs where (ys, zs) = partition (<= x) xs |
||
== |
=={{header|IDL}}== |
||
[[Category:IDL]] |
|||
IDL has a powerful optimized <tt>sort()</tt> built-in. The following is thus merely for demonstration. |
IDL has a powerful optimized <tt>sort()</tt> built-in. The following is thus merely for demonstration. |
||
Line 180: | Line 178: | ||
-5 3 12 17 99 |
-5 3 12 17 99 |
||
== |
=={{header|MAXScript}}== |
||
[[Category:MAXScript]] |
|||
fn quickSort arr = |
fn quickSort arr = |
||
( |
( |
||
Line 211: | Line 208: | ||
a = quickSort a |
a = quickSort a |
||
== |
=={{header|Python}}== |
||
[[Category:Python]] |
|||
def quickSort(arr): |
def quickSort(arr): |
||
less = [] |
less = [] |
||
Line 235: | Line 231: | ||
a = quickSort(a) |
a = quickSort(a) |
||
== |
=={{header|Seed7}}== |
||
[[Category:Seed7]] |
|||
<pre> |
<pre> |
||
const proc: quickSort (inout array elemType: arr, in integer: left, in integer: right) is func |
const proc: quickSort (inout array elemType: arr, in integer: left, in integer: right) is func |