Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,15 @@
(define (median L) ;; O(n log(n))
(set! L (vector-sort! < (list->vector L)))
(define dim (// (vector-length L) 2))
(if (integer? dim)
(// (+ [L dim] [L (1- dim)]) 2)
[L (floor dim)]))
(median '( 3 4 5))
→ 4
(median '(6 5 4 3))
→ 4.5
(median (iota 10000))
→ 4999.5
(median (iota 10001))
→ 5000