Created
October 24, 2013 07:55
-
-
Save schickling/7132994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Tree = Branch [Tree] | |
deriving Show | |
{- first int is the min cover; second int is the min cover that includes the root -} | |
minVC :: Tree -> (Int, Int) | |
minVC (Branch subtrees) = let | |
costs = map minVC subtrees | |
minWithRoot = 1 + sum (map fst costs) in | |
(min minWithRoot (sum (map snd costs)), minWithRoot) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment