Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -6,7 +6,7 @@ insertAt e k = uncurry(++).second ((e:).drop 1). splitAt k
swapElems :: [a] -> Int -> Int -> [a]
swapElems xs i j = insertAt (xs!!j) i $ insertAt (xs!!i) j xs
stoogeSort [] = []
stoogeSort [x] = [x]
stoogeSort xs = doss 0 (length xs - 1) xs
@ -15,6 +15,6 @@ doss i j xs
| j-i>1 = doss i (j-t) $ doss (i+t) j $ doss i (j-t) xs'
| otherwise = xs'
where t = (j-i+1)`div`3
xs'
| xs!!j < xs!!i = swapElems xs i j
| otherwise = xs
xs'
| xs!!j < xs!!i = swapElems xs i j
| otherwise = xs