Anonymous user
Sorting algorithms/Quicksort: Difference between revisions
added J solution
(Joy) |
(added J solution) |
||
Line 189:
IDL> print,qs([3,17,-5,12,99])
-5 3 12 17 99
=={{header|J}}==
sel=: 1 : 'x # ['
quicksort=: 3 : 0
if. 1 >: #y do. y else. (quicksort y <sel e),(y =sel e),quicksort y >sel e=.y{~?#y end.
)
To actually sort data in J, it is more convenient and more efficient to use<tt> /:~ </tt>.
=={{header|Joy}}==
|