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 = CHARINT;
 
PROC inplace gnome sort = (REF[]SORTSTRUCT list)REF[]SORTSTRUCT:
Line 467:
in place gnome sort(LOC[LWB seq: UPB seq]SORTSTRUCT:=seq);
 
[]SORTSTRUCT charunsorted array data = "big( fjords-40, vex77, quick9, waltz0, nymph"2, 1, 0, 1701 );
print((gnome sort(charunsorted array data), new line))</syntaxhighlight>
</syntaxhighlight>
Output:
<pre>
-40 +0 +0 +1 +2 +9 +77 +1701
abcdefghiijklmnopqrstuvwxyz
</pre>
 
3,021

edits