Anonymous user
Sorting algorithms/Cycle sort: Difference between revisions
m
→version 4: changed alignment of a couple of comments.
m (→version 4: changed alignment of a couple of comments.) |
|||
Line 1,467:
end /*while p\==c*/
end /*c*/
/* [↓] display the sorted list
_=@.1; do j=2 to #; _=_ @.j; end; say ' sorted list: ' _
return w /* [↓] find where to put X into @ */
.swap: do p=p while x==@.p; end; parse value @.p x with x @.p; w=w+1; return</lang>
'''output''' is identical to the 2<sup>nd</sup> version.
|