SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Chapter:
Trees
Exercise:
Exercises
Question:32 | ISBN:9781118771334 | Edition: 6

Question

For a tree T, let nI denote the number of its internal nodes, and let nE denote the number of its external nodes. Show that if every internal node in T has exactly 3 children, then nE = 2nI +1.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

To show that if every internal node in tree T has exactly 3 children, then nE = 2nI + 1, we can use the following proof by induction:

Base Case:

For a tree with only one internal node and no external nodes, nI = 1 and nE = 0.

Plugging these values into the equation nE = 2nI + 1 gives 0 = 2(1) + 1, which is true.

Inductive Hypothesis:

Assume that for a tree with k internal nodes, where every internal node has exactly 3 children, the equation nE = 2nI + 1 holds true.

Inductive Step:

Now, consider a tree T' with k + 1 internal nodes, where every internal node has exactly 3 children.

Let's denote the number of external nodes in T' as nE' and the number of internal nodes as nI'.

We can think of T' as being formed by adding a subtree to an existing tree T, which has k internal nodes.

The additional subtree must be attached to one of the external nodes of T, resulting in the addition of one internal node and three external nodes.

The number of internal nodes in T' is nI' = nI + 1, as we have added one internal node.

The number of external nodes in T' is nE' = nE + 3, as we have added three external nodes.

Using the inductive hypothesis, we can substitute nE = 2nI + 1 for T into the equation for T':

nE' = nE + 3 = (2nI + 1) + 3 = 2nI + 4 = 2(nI + 1) + 2 = 2(nI' - 1) + 2 = 2nI' + 1

This shows that the equation nE = 2nI + 1 holds true for the tree T'.

By the principle of mathematical induction, the equation holds true for any tree T where every internal node has exactly 3 children.

Therefore, if every internal node in T has exactly 3 children, nE = 2nI + 1.

0 0

Discussions

Post the discussion to improve the above solution.