Solve the following problems in Haskell.
Write a function treeFoldr
that performs a right
fold of a function over the values in a binary tree.
Use treeFoldr
to write functions that
add all the values in a binary tree of numbers;
generate a list containing all the values in a binary tree
Define a balanced tree as follows: for any node, the number of nodes in the left and right subtrees differ by at most 1.
Write a function isBalanced
that determines whether a tree is balanced.
What is your function's worst-case big-O running times?