V
V
Vitaly the Wise2017-09-24 16:38:17
Haskell
Vitaly the Wise, 2017-09-24 16:38:17

How to implement combineTrees and extractMin in haskell?

Hello. I'm doing a Haskell lab and ran into problems. Can someone help

data BinomTree a = Node a Int [BinomTree a]
               deriving (Eq, Ord, Show)
type BinomHeap a = [BinomTree a]

-- ������ 1 -----------------------------------------
combineTrees :: Ord a => BinomTree a -> BinomTree a -> BinomTree a
combineTrees = undefined
  
-- ������ 2 -----------------------------------------
extractMin :: Ord a => BinomHeap a -> a
extractMin = undefined

-- ������ 3 ----------------------------------------- 
mergeHeaps :: Ord a => BinomHeap a -> BinomHeap a -> BinomHeap a
mergeHeaps = undefined
 
-- ������ 4 -----------------------------------------
insert :: Ord a => a -> BinomHeap a -> BinomHeap a
insert = undefined

-- ������ 5 -----------------------------------------
deleteMin :: Ord a => BinomHeap a -> BinomHeap a
deleteMin = undefined

-- ������ 6 -----------------------------------------
binomSort :: Ord a => [a] -> [a]
binomSort = undefined

-- ������ 7 -----------------------------------------
toBinary :: BinomHeap a -> [Int]
toBinary = undefined

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Syrovetsky, 2017-09-24
@cblp

Everything is simple: you need undefinedto replace it with the implementation of the corresponding functions. Good luck!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question