Question: 3. The following refer to trees. Please note that tree height is used here as your text defines it: a tree with height n has

3. The following refer to trees. Please note that tree height is used here as your text defines it: a tree with height n has n+1 levels, numbered from 0 to n.

a. If a 3-ary tree has 16 nodes total, how many of these nodes are external?

b. If a binary tree has height 4, what is the minimum number of total nodes the tree can have?

c. If a binary tree has height 4, what is the maximum number of total nodes the tree can have?

4. The following refer to breadth-first traversals of graphs and trees.

a. What is the purpose of the queue in breadth-first traversal?

b. Suppose you had a function call displayAtDepthN, which when given a tree and depth would display only the nodes at that depth. Explain how this could be used to give a breadth-first traversal of the tree, and why it would not be as efficient as one using a queue.

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!