Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
#lang racket
|
||||
(define (shell-sort! xs)
|
||||
(define ref (curry vector-ref xs))
|
||||
(define (new Δ) (if (= Δ 2) 1 (quotient (* Δ 5) 11)))
|
||||
(let loop ([Δ (quotient (vector-length xs) 2)])
|
||||
(unless (= Δ 0)
|
||||
(for ([xᵢ (in-vector xs)] [i (in-naturals)])
|
||||
(let while ([i i])
|
||||
(cond [(and (>= i Δ) (> (ref (- i Δ)) xᵢ))
|
||||
(vector-set! xs i (ref (- i Δ)))
|
||||
(while (- i Δ))]
|
||||
[else (vector-set! xs i xᵢ)])))
|
||||
(loop (new Δ))))
|
||||
xs)
|
||||
Loading…
Add table
Add a link
Reference in a new issue