Anonymous user
Sorting algorithms/Comb sort: Difference between revisions
m
→{{header|Elena}}
(Scala contribution added.) |
|||
Line 622:
</pre>
=={{header|Elena}}==
ELENA 3.
<lang elena>import extensions.
import system'math.
import system'routines.
extension
{
combSort
[
var list := self clone.
real gap := list length.
bool swaps := true.
Line 639:
gap /= 1.247330950103979r.
if (gap<1) [ gap := 1 ].
int i := 0.
swaps := false.
Line 653:
].
].
^ list
]
}
[
var list := (3, 5, 1, 9, 7, 6, 8, 2, 4 ).
console printLine("before:", list).
console printLine("after :", list combSort).
]
{{out}}
<pre>
|