Sorting algorithms/Gnome sort: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) (→version 2: corrected in sync with REXX version 2) |
m (→version 1: changed separator comments and the array header.) |
||
Line 1,669: | Line 1,669: | ||
call show@ ' after sort' /*show "after" array elements.*/ |
call show@ ' after sort' /*show "after" array elements.*/ |
||
exit /*stick a fork in it, we're done.*/ |
exit /*stick a fork in it, we're done.*/ |
||
/* |
/*──────────────────────────────────GNOMESORT subroutine────────────────*/ |
||
gnomeSort: procedure expose @.; parse arg n; k=2 /*n=num items.*/ |
gnomeSort: procedure expose @.; parse arg n; k=2 /*n=num items.*/ |
||
do j=3 while k<=n; km=k-1 /*KM=prev item*/ |
do j=3 while k<=n; km=k-1 /*KM=prev item*/ |
||
Line 1,679: | Line 1,679: | ||
/*──────────────────────────────────GEN@ subroutine─────────────────────*/ |
/*──────────────────────────────────GEN@ subroutine─────────────────────*/ |
||
gen@: !='deadbeef'x ...; @.=! /*default none-value; allows null*/ |
gen@: !='deadbeef'x ...; @.=! /*default none-value; allows null*/ |
||
@.1 = ' |
@.1 = '---the seven virtues---' /* [↓] indent the seven virtues.*/ |
||
@.2 = '=======================' ; @.6 = ' Fortitude' |
@.2 = '=======================' ; @.6 = ' Fortitude' |
||
@.3 = ' Faith' ; @.7 = ' Justice' |
@.3 = ' Faith' ; @.7 = ' Justice' |