Jump to content

Sorting algorithms/Shell sort: Difference between revisions

→‎E: add E example
(+ AutoHotkey contributed by Laszlo from ahk forums)
(→‎E: add E example)
Line 196:
}
</lang>
 
=={{header|E}}==
 
{{trans|Python}}
 
<lang e>/** Shell sort (in-place) */
def shellSort(array) {
var inc := array.size() // 2
while (inc.aboveZero()) {
for var i => a in array {
while (i >= inc && (def b := array[i - inc]) > a) {
array[i] := b
i -= inc
}
array[i] := a
}
inc := if (inc <=> 2) { 1 } else { (inc * 5.0 / 11).floor() }
}
}</lang>
 
=={{header|Forth}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.