Sorting algorithms/Stooge sort: Difference between revisions

added Arturo
m (syntax highlighting fixup automation)
(added Arturo)
Line 226:
after: -201 +0 +4 +9 +9 +67 +231
</pre>
 
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">innerStoogeSort: function [a, i, j][
if a\[j] < a\[i] [
t: a\[i]
a\[i]: a\[j]
a\[j]: t
]
if 1 < j - i [
t: (1 + j - i) / 3
innerStoogeSort a i j-t
innerStoogeSort a i+t j
innerStoogeSort a i j-t
]
]
 
stoogeSort: function [arr][
result: new arr
innerStoogeSort result 0 dec size result
return result
]
 
print stoogeSort [3 1 2 8 5 7 9 4 6]</syntaxhighlight>
 
{{out}}
 
<pre>1 2 3 4 5 6 7 8 9</pre>
 
=={{header|AutoHotkey}}==
1,532

edits