All pastes #2053503 Raw Edit

Anonymous

public text v1 · immutable
#2053503 ·published 2011-05-03 15:37 UTC
rendered paste body
comb_sort(list of t)
    gap = list.count
    temp as t
    swapped = false
    while gap > 1 or not swapped
        swapped = false
        if gap > 1 then
            gap = floor(gap/1.3)
        i = 0
        while i + gap < list.count
            if list(i) > list(i + gap)
                temp = list(i) // swap
                list(i) = list(i + gap)
                list(i + gap) = temp
            i += 1