Copyright | Copyright (C) 2021 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P58.
Synopsis
- symmetricBalancedTrees :: Int -> [Tree ()]
Documentation
symmetricBalancedTrees :: Int -> [Tree ()] Source #
Construct all symmetric, completely balanced binary trees with a given number of nodes.
Examples
>>>
printTreeList $ symmetricBalancedTrees 5
[ Branch () (Branch () (Branch () Empty Empty) Empty) (Branch () Empty (Branch () Empty Empty)) , Branch () (Branch () Empty (Branch () Empty Empty)) (Branch () (Branch () Empty Empty) Empty) ]