CS代考程序代写 module HW2

module HW2
where

{- 1. longest & longestTail & mylongest – 20%-}

{- (a) longest – 5% -}

{- (b) longestTail – 10% -}

{- (c) mylongest – 5% -}

———————————————————–

{- 2. getMonths & monthlyCans 20% -}

{- (a) getMonths – 10%-}
— please don’t include the myCatsLog list in your dolution file.

{- (b) getMonths – 10%-}

———————————————————–

{- 3. convert, sumGrades, and organize – 23% -}

–define the Grade datatype
data Grade = LETTER Char | SCORE Int | PASS | FAIL
deriving (Show, Eq, Ord)

{- (a) convert – 3% -}

{- (b) sumGrades – 10% -}

{- (c) organize – 10% -}

———————————————————–

{-4 – createLevelTree & listify & isBalanced – 27%-}

data Tree a = LEAF a | NODE a (Tree a) (Tree a)
deriving (Show, Read, Eq)

data LevelTree a = LLEAF a | LNODE (a,Int,Int) (LevelTree a) (LevelTree a)
deriving (Show, Read, Eq)

{- (a) createLevelTree – 12% -}

{- (b) listify – 6% -}

{- (c) isBalanced – 10% -}

{-Testing your tree functions – 4%-}
— include your tree examples in the test file.