Jump to content

Sorting algorithms/Shell sort: Difference between revisions

m
no edit summary
(Added in-place solution in Swift 2.1, based on Python in-place example.)
mNo edit summary
Line 2,026:
───────────────────────────────────────────────────────────────────────────────
</pre>
 
=={{header|Ring}}==
<lang ring>
siz = 100
a = list(siz)
for i = 1 to siz
a[i] = floor(random(100))
see a[i] + nl
next
incr = floor(siz / 2)
while incr > 0
for i = 1 to siz
j = i
temp = a[i]
while (j >= incr and fabs(j-incr) > 0 and a[fabs(j-incr)] > temp)
a[j] = a[j-incr]
j = j - incr
end
a[j] = temp
next
incr = floor(incr / 2.2)
end
 
for i = 1 to siz
see a[i] + nl
next
</lang>
 
=={{header|Ruby}}==
2,468

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.