Question: ( a ) Use the SML system to define a datatype for labeled three branch trees, the trees with possible zero, one, two, or three

(a)Use the SML system to define a datatype for labeled three branch trees, the trees with
possible zero, one, two, or three branches. Using integers to label the nodes of the trees. No
polymorphic definition for this problem. Your definition needs to be accepted by SML.
(b) Draw a concrete three branch tree of at least 20 nodes but no more than 35 nodes. There must
be some one, two, and three branches in your tree. The integers labeling the nodes range from
40 to 75 and each node has only one integer label. Represent this concrete three branch tree
by using your three branch tree datatype definition. Your representation needs to be accepted
by SML as an instance of the datatype you defined in (a).
(c) Use fun in SML to define a function that performs on any three branch tree of the datatype
you defined in (a). This function sums all integer labels in the tree. Your definition needs to
be accepted by SML.
(d) Apply this function to your concrete three branch tree, as represented using the datatype you
defined, to check the correctness of the result

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 Programming Questions!