Question: please explain on how to do this problem Given the following ML declarations of a binary tree type with integers in the leaf nodes and

 please explain on how to do this problem Given the following

please explain on how to do this problem

Given the following ML declarations of a binary tree type with integers in the leaf nodes and of five functions operating on trees: datatype tree -L of int leaf with an integer ) | N of tree treenode with two subtrees ) fun max (n, m) =if n > m then n else m fun a (L i) fun b (L i) lb(N(1, r))=max (b 1, b r) fun c (L i) fun d (L i) Id(N(1, r)) 1 + d 1 + d r fun e (L i) le(N(1, r))=1+max (e 1, e r) In each function definition, the first line is the case for a leaf node (i.e., the base case of the recursion), and the second line recursively calls the function for the left and right subtrees These functions compute the height of the tree, and the number of leaves in the tree, the sum of all the values in the leaves. the number of interior nodes in the tree, the maximum value of any leaf node in the tree Associate the functions with their descriptions. Try it first without typing them in

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!