Sorting algorithms/Gnome sort: Difference between revisions
→{{header|ALGOL 68}}: Sort numbers, as specified in the task
(Added Algol W) |
(→{{header|ALGOL 68}}: Sort numbers, as specified in the task) |
||
Line 447:
{{works with|ELLA ALGOL 68|Any (with appropriate job cards AND formatted transput statements removed) - tested with release 1.8.8d.fc9.i386}}
<syntaxhighlight lang="algol68">MODE SORTSTRUCT =
PROC inplace gnome sort = (REF[]SORTSTRUCT list)REF[]SORTSTRUCT:
Line 467:
in place gnome sort(LOC[LWB seq: UPB seq]SORTSTRUCT:=seq);
[]SORTSTRUCT
print((gnome sort(
</syntaxhighlight>
Output:
<pre>
-40 +0 +0 +1 +2 +9 +77 +1701
</pre>
|