Anonymous user
Sorting algorithms/Gnome sort: Difference between revisions
no edit summary
m (→{{header|Quackery}}: tweaked indentation) |
imported>Chinhouse No edit summary |
||
Line 2,350:
for i = 0 upto 9: message decimal a[i]; endfor
end</syntaxhighlight>
=={{header|MiniScript}}==
<syntaxhighlight lang="miniscript">
gnomesort = function(a)
i = 1
j = 2
while i < a.len
if a[i-1] <= a[i] then
i = j
j = j + 1
else
k = a[i-1]
a[i-1] = a[i]
a[i] = k
i = i - 1
if i == 0 then
i = j
j = j + 1
end if
end if
end while
end function
a = [3, 7, 4, 2, 5, 1, 6]
gnomesort(a)
print a
</syntaxhighlight>
{{out}}
<pre>[1, 2, 3, 4, 5, 6, 7]
</pre>
=={{header|NetRexx}}==
|