Guided Practice 6.2: A Different Kind of Tree

Consider a data structure of trees that have leaves with numbers in them, and two kinds of interior nodes: one kind with two sons and the other kind with three sons. Here's an example:

example tree

These trees are similar, but not identical to what are usually called 2-3 trees.

Write a data definition for these trees. Write leaf-max for these trees. Write a function double-all that takes one of these trees and returns a tree of the same shape in which all the leaves are doubled. For example, double-all applied to the tree above should return the tree

example tree


(Remember, you won't get anything about of this exercise unless you actually write the code and test it.)

Last modified: Thu Oct 9 12:31:04 Eastern Daylight Time 2014