Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
18
Task/Priority-queue/Haskell/priority-queue-6.hs
Normal file
18
Task/Priority-queue/Haskell/priority-queue-6.hs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
testList = [ (3, "Clear drains"),
|
||||
(4, "Feed cat"),
|
||||
(5, "Make tea"),
|
||||
(1, "Solve RC tasks"),
|
||||
(2, "Tax return") ]
|
||||
|
||||
testPQ = fromListPQ testList
|
||||
|
||||
main = do -- slow build
|
||||
mapM_ print $ toListPQ $ foldl (\pq (k, v) -> pushPQ k v pq) emptyPQ testList
|
||||
putStrLn "" -- fast build
|
||||
mapM_ print $ toListPQ $ fromListPQ testList
|
||||
putStrLn "" -- combined fast sort
|
||||
mapM_ print $ sortPQ testList
|
||||
putStrLn "" -- test merge
|
||||
mapM_ print $ toListPQ $ mergePQ testPQ testPQ
|
||||
putStrLn "" -- test adjust
|
||||
mapM_ print $ toListPQ $ adjustPQ (\x y -> (x * (-1), y)) testPQ
|
||||
Loading…
Add table
Add a link
Reference in a new issue