Sorting algorithms/Strand sort: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added/changed comments and whitespace, changed indentations, simplified a subroutine.) |
m (→{{header|Sidef}}: minor code simplifications) |
||
Line 1,535: | Line 1,535: | ||
var out = [x.shift]; |
var out = [x.shift]; |
||
if (x.len) { |
if (x.len) { |
||
for i in (-x.len .. -1) { |
|||
if (x[i] >= out[-1]) { |
if (x[i] >= out[-1]) { |
||
out.append(x.pop_at(i)); |
out.append(x.pop_at(i)); |
||
Line 1,552: | Line 1,552: | ||
} |
} |
||
var a = 10.of {100. |
var a = 10.of { 100.irand }; |
||
say "Before: #{a}"; |
say "Before: #{a}"; |
||
say "After: #{strand_sort(a)}";</lang> |
say "After: #{strand_sort(a)}";</lang> |