Jump to content

Sorting algorithms/Counting sort: Difference between revisions

m
Line 1,290:
(define (counting-sort xs min max)
(define ns (make-vector (+ max (- min) 1) 0))
(for ([x xs]) (vector-set! ns (- x min) (+ (vector-ref ns (- x min)) 1)))
(vector-set! ns (- x min) (+ (vector-ref ns (- x min)) 1)))
(define ys (vector-copy xs))
(for/fold ([i 0]) ([n ns] [x (in-naturals)])
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.