Sorting algorithms/Comb sort: Difference between revisions

Added 11l
(Updated to work with version 1.4 of Nim.)
(Added 11l)
Line 51:
'''end function'''
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F combsort(&input)
V gap = input.len
V swaps = 1B
L gap > 1 | swaps
gap = max(1, Int(gap / 1.25))
swaps = 0B
L(i) 0 .< input.len - gap
V j = i + gap
I input[i] > input[j]
swap(&input[i], &input[j])
swaps = 1B
 
V y = [88, 18, 31, 44, 4, 0, 8, 81, 14, 78, 20, 76, 84, 33, 73, 75, 82, 5, 62, 70]
combsort(&y)
assert(y == sorted(y))
print(y)</lang>
 
{{out}}
<pre>
[0, 4, 5, 8, 14, 18, 20, 31, 33, 44, 62, 70, 73, 75, 76, 78, 81, 82, 84, 88]
</pre>
 
=={{header|360 Assembly}}==
Line 127 ⟶ 152:
-31 0 1 2 2 4 45 58 65 69 74 82 82 83 88 89 99 104 112 782
</pre>
 
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
1,480

edits