[ create a new paste ] login | about

edvakf

Name:
Email:
Site/Blog:
Location:
Default language:
Favorite languages:
About:

Saved pastes by edvakf:

Haskell, pasted on Aug 19:
1
2
3
4
5
import List (sort)

solveCoin :: Integer -> [Integer] -> [[Integer]]
solveCoin total coins = 
  let coins' = reverse $ sort coins
...
view (19 lines, 1 line of output)
Haskell, pasted on Dec 8:
1
2
3
4
5
bubbleSort :: Ord a => [a] -> [a]
bubbleSort = bubbleSortBy compare

bubbleSortBy :: Ord a => (a -> a -> Ordering) -> [a] -> [a]
bubbleSortBy _ [] = []
...
view (16 lines, 1 line of output)
Haskell, pasted on Dec 8:
1
2
3
4
5
bubbleSort :: Ord a => [a] -> [a]
bubbleSort = bubbleSortBy compare

bubbleSortBy :: Ord a => (a -> a -> Ordering) -> [a] -> [a]
bubbleSortBy cmp xs = bubbleSortBy' cmp xs []
...
view (18 lines, 1 line of output)
Haskell, pasted on Dec 4:
1
2
3
4
5
import List

-- shell sort
shellSort :: Ord a => [a] -> [a]
shellSort = shellSortBy compare
...
view (43 lines, 1 line of output)
Haskell, pasted on Dec 2:
1
2
3
4
5
mergeSort :: Ord a => [a] -> [a]
mergeSort = mergeSortBy compare

mergeSortBy :: Ord a => (a -> a -> Ordering) -> [a] -> [a]
mergeSortBy _ [] = []
...
view (25 lines, 1 line of output)
Haskell, pasted on Dec 2:
1
2
3
4
5
mergeSort :: Ord a => [a] -> [a]
mergeSort = mergeSortBy compare

mergeSortBy :: Ord a => (a -> a -> Ordering) -> [a] -> [a]
mergeSortBy cmp xs = mergeSortBy' cmp xs $ length xs
...
view (23 lines, 1 line of output)
Haskell, pasted on Dec 2:
1
2
3
4
5
mergeSort :: Ord a => [a] -> [a]
mergeSort = mergeSortBy compare

mergeSortBy :: Ord a => (a -> a -> Ordering) -> [a] -> [a]
mergeSortBy cmp [] = []
...
view (25 lines, 1 line of output)
Haskell, pasted on Dec 1:
1
2
3
4
import List

insertionSort :: Ord a => [a] -> [a]
insertionSort = insertionSortBy compare
...
view (10 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort p [] = []
insertionSort p (x:xs) = fst $ foldl (\(os,m) n -> if not (p m n) then ((insert p os n), m) else (os++[n], n)) ([x], x) xs
    
insert p os u = ls ++ (u:hs)
    where
...
view (8 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort p [] = []
insertionSort p (x:xs) = fst $ foldl (\(os,m) n -> if m > n then ((insert p os n), m) else (os++[n], n)) ([x], x) xs
    
insert p os u = ls ++ (u:hs)
    where
...
view (8 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort p [] = []
insertionSort p (x:xs) = fst $ foldl (\(os,m) n -> if m > n then ((insert p os n), m) else (os++[n], n)) ([x], x) xs
    
insert p os u = ls ++ (u:hs)
    where
...
view (8 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort [] = []
insertionSort (x:xs) = fst $ foldl (\(os,m) n -> if m > n then ((insert os n), m) else (os++[n], n)) ([x], x) xs

insert os u = ls ++ (u:hs)
    where
...
view (8 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort :: (Ord a) => (a -> a -> Bool) -> [a] -> [a]
insertionSort p [] = []
insertionSort p (x:xs) = insertionSort' [x] xs
    where
        insertionSort' os [] = os
...
view (26 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort :: (Ord a) => (a -> a -> Bool) -> [a] -> [a]
insertionSort p [] = []
insertionSort p (x:xs) = insertionSort' [x] xs
    where
        insertionSort' os [] = os
...
view (26 lines, 1 line of output)
Haskell, pasted on Nov 30:
1
2
3
4
5
insertionSort :: (Ord a) => [a] -> [a]
insertionSort [] = []
insertionSort (x:xs) = insertionSort' [x] xs

insertionSort' :: (Ord a) => [a] -> [a] -> [a]
...
view (30 lines, 1 line of output)