Sorting algorithms/Cocktail sort: Difference between revisions
→version handles blanks: It is a Rexx idiom to use <stem>.0 to hold the number of items in numerically-suffixed stem arrays.
(Added Quackery.) |
(→version handles blanks: It is a Rexx idiom to use <stem>.0 to hold the number of items in numerically-suffixed stem arrays.) |
||
Line 3,661:
call show@ 'before sort' /*show unsorted array elements. */
say copies('█', 101) /*show a separator line (a fence). */
call cocktailSort
call show@ ' after sort' /*show sorted array elements. */
exit /*stick a fork in it, we're all done. */
Line 3,702:
@.23='the world ◄─── XXI'
@.24='the fool [often unnumbered] ◄─── XXII'
return
▲ return /* [↑] adjust for DO loop advancement.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
show@: w= length(
do j=1 to @.0 /*@.0 is the number of items
say 'element' right(j, w) arg(1)":"
return /* └─────max width of any line.*/</syntaxhighlight>
{{out|output|text= when using the internal default inputs:}}
|