Question: Write a Haskell function that generates all binary trees with empty leaves of size n. Then, given a binary tree, write a function that counts

Write a Haskell function that generates all binary trees with empty leaves of size n. Then, given a binary tree, write a function that counts the number of leaves and another function that the number of internal nodes. What do you observe about the two results? Write a short proof by induction as a comment added to your program stating that your observation applies to binary trees of any size. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!