Sorting algorithms/Comb sort: Difference between revisions

Added Easylang
(Added XPL0 example.)
(Added Easylang)
 
(One intermediate revision by one other user not shown)
Line 1,290:
[0 1 2 3 4 5 6 7 8 9]
</pre>
=={{header|EasyLang}}==
<syntaxhighlight>
proc combsort . d[] .
gap = len d[]
while gap > 1 or swaps = 1
gap = higher 1 (gap div 1.25)
swaps = 0
for i = 1 to len d[] - gap
j = i + gap
if d[i] > d[j]
swap d[i] d[j]
swaps = 1
.
.
.
.
d[] = [ 88 18 31 44 4 0 8 81 14 78 20 76 84 33 73 75 82 5 62 70 ]
combsort d[]
print d[]
</syntaxhighlight>
{{out}}
<pre>
[ 0 4 5 8 14 18 20 31 33 44 62 70 73 75 76 78 81 82 84 88 ]
</pre>
 
=={{header|Eiffel}}==
<syntaxhighlight lang="eiffel">
Line 3,552 ⟶ 3,577:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">var combSort = Fn.new { |a|
var gap = a.count
while (true) {
Line 3,573 ⟶ 3,598:
}
 
var asarray = [ [4, 65, 2, -31, 0, 99, 2, 83, 782, 1], [7, 5, 2, 6, 1, 4, 2, 6, 3] ]
for (a in asarray) {
System.print("Before: %(a)")
combSort.call(a)
2,083

edits