Created
August 3, 2012 11:09
-
-
Save hyone/3246701 to your computer and use it in GitHub Desktop.
Number of binary trees have N leaves
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
splites :: Int -> [(Int, Int)] | |
splites n = [ (x, n - x) | x <- [1..n-1] ] | |
count :: Int -> Int | |
count 1 = 1 | |
count n = sum $ do | |
(i, j) <- splites n | |
return $ count i * count j |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment