Anonymous user
Sorting algorithms/Insertion sort: Difference between revisions
Sorting algorithms/Insertion sort (view source)
Revision as of 23:21, 11 November 2014
, 9 years ago→{{header|REXX}}: shorten a long literal by one byte, changed a variable name, made a variable global.
m (→{{header|REXX}}: changed some comments, variable names, and some alignments.) |
m (→{{header|REXX}}: shorten a long literal by one byte, changed a variable name, made a variable global.) |
||
Line 1,730:
/*──────────────────────────────────GEN@ subroutine─────────────────────*/
gen@: @.= /*assign default value to array. */
@.1 = "---Monday's Child Is Fair of Face
@.2 = "Monday's child is fair of face;"
@.3 = "Tuesday's child is full of grace;"
Line 1,741:
do #=1 while @.# \=='' /*find how many entries in array.*/
end /*short and sweet DO loop, eh? */
return
/*──────────────────────────────────INSERTIONSORT subroutine────────────*/
insertionSort: procedure expose @.
do i=2 to
jp=j+1; @.jp=@.j
end /*j*/
Line 1,762:
{{out}}
<pre>
element 1 before sort: ---Monday's Child Is Fair of Face
element 2 before sort: Monday's child is fair of face;
element 3 before sort: Tuesday's child is full of grace;
Line 1,772:
element 9 before sort: Is blithe and bonny, good and gay.
───────────────────────────────────────────────────────────────────────────────
element 1 after sort: ---Monday's Child Is Fair of Face
element 2 after sort: But the child that is born on the Sabbath day
element 3 after sort: Friday's child is loving and giving;
|