Home /
Expert Answers /
Computer Science /
1-binary-treesa-regular-binary-tree-is-a-binary-tree-whose-internal-nodes-have-exactly-two-subtrees-pa471
(Solved): 1. Binary TreesA regular binary tree is a binary tree whose internal nodes have exactly two subtrees ...
1. Binary Trees
A regular binary tree is a binary tree whose internal nodes have exactly two subtrees.
a. Write a function height(t) that returns the height of a regular binary tree, where the height
of a tree is the distance (number of arcs) between the root and the farthest leaf. Assume that
you have a Boolean function leaf(t), which returns TRUE if t is a leaf.
b. Show the trace of execution of this function on the following tree:
1. Binary Trees A regular binary tree is a binary tree whose internal nodes have exactly two subtrees. a. Write a function height (t) that returns the height of a regular binary tree, where the height of a tree is the distance (number of arcs) between the root and the farthest leaf. Assume that you have a Boolean function leaf (t), which returns TRUE ift is a leaf. b. Show the trace of execution of this function on the following tree: H D J B K E A FL G