Jump to content

Sorting algorithms/Comb sort: Difference between revisions

no edit summary
(I added Javascript implementation of Comb Sort. Tested with many test cases)
No edit summary
Line 1,730:
element 23 after sort: tridecagon 13
</pre>
 
=={{header|Ring}}==
<lang ring>
aList = [3,5,1,2,7,4,8,3,6,4,1]
see combsort(aList)
 
func combsort t
gapd = 1.2473
gap = len(t)
swaps = 0
while gap + swaps > 1
k = 0
swaps = 0
if gap > 1 gap = floor(gap / gapd) ok
for k = 1 to len(t) - gap
if t[k] > t[k + gap]
temp = t[k]
t[k] = t[k + gap]
t[k + gap] = temp
swaps = swaps + 1 ok
next
end
return t
</lang>
 
=={{header|Ruby}}==
2,468

edits

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