September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,16 @@
|
|||
(defparameter *shrink* 1.3)
|
||||
|
||||
(defun comb-sort (input)
|
||||
(loop with input-size = (length input)
|
||||
with gap = input-size
|
||||
with swapped
|
||||
do (when (> gap 1)
|
||||
(setf gap (floor gap *shrink*)))
|
||||
(setf swapped nil)
|
||||
(loop for lo from 0
|
||||
for hi from gap below input-size
|
||||
when (> (aref input lo) (aref input hi))
|
||||
do (rotatef (aref input lo) (aref input hi))
|
||||
(setf swapped t))
|
||||
while (or (> gap 1) swapped)
|
||||
finally (return input)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue