Anonymous user
Sorting algorithms/Permutation sort: Difference between revisions
Sorting algorithms/Permutation sort (view source)
Revision as of 23:24, 22 September 2020
, 3 years ago→{{header|REXX}}: changed whitespace and comments.
ReeceGoding (talk | contribs) (→{{header|R}}: New solution. It's so simple that I'm doubting myself.) |
m (→{{header|REXX}}: changed whitespace and comments.) |
||
Line 2,057:
call gen /*generate the array elements. */
call show 'before sort' /*show the before array elements. */
call pSort L
call show ' after sort' /*show the after array elements. */
say; say 'Permutation sort took ' ? " permutations to find the sorted list."
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
.pAdd:
show:
/*──────────────────────────────────────────────────────────────────────────────────────*/
gen:
/*──────────────────────────────────────────────────────────────────────────────────────*/
isOrd:
end /*j*/ /* [↑] Out of order? ¬sorted*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
.
/*──────────────────────────────────────────────────────────────────────────────────────*/
pSort:
end /*?*/;
{{out|output|text= when using the default (internal) inputs:}}
<pre>
|