(**) Construct completely balanced binary trees In a completely
balanced binary tree, the following property holds for every
node: The number of nodes in its left subtree and the number of
nodes in its right subtree are almost equal, which means their
difference is not greater than one. Write a function cbal-tree
to construct completely balanced binary trees for a given number
of nodes. The predicate should generate all solutions via
backtracking. Put the letter 'x' as information into all nodes
of the tree. cbalTree :: Int -> [Tree Char] cbalTree 0 = [Empty]
cbalTree n = let (q, r) = (n - 1) `quotRem` 2 in [Branch 'x'
left right | i <- [q .. q + r], left <- cbalTree i, right <-
cbalTree (n - i - 1)] This solution uses a list comprehension to
enumerate all the trees, in a style that is more natural than
standard backtracking. The base case is a tree of size 0, for
which Empty is the only possibility. Trees of size n == 1 or
larger consist of a branch, having left and right subtrees with
sizes that sum up to n