Explore BrainMass
Share

# Calculating the depth of a binary tree

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

10.30.
Use the integers from one to nine to build a nine-node binary search tree with no duplicate data values

(a). Give the possible root node values if the depth of the tree is 4.
(b). Answer part (a) for depths of 5, 6, 7, and 8.

https://brainmass.com/computer-science/trees/calculating-depth-binary-tree-269799

#### Solution Preview

There are several trees that could be formed with the 9 values. Here is an example of one such tree.

5
/
3 7
/ /
2 4 6 8
/
1 9

A tree with depth 4 means that either the left or the right subtree must have a depth of 3 and the other subtree a depth less than or equal to three. So the focus is on how many elements can be in a tree of depth 3. Then when we know that we can pick all of the possible root values that will allow for the proper ...

#### Solution Summary

This solution shows how to calculate the depth of a binary tree. Various configurations of the tree are considered.

\$2.19