26.2k views
5 votes
A full 5-ary tree has 37 internal nodes. how many nodes does it have in total?

User Galupuf
by
8.6k points

1 Answer

3 votes

A full 5-ary tree with 37 internal nodes has 381 nodes in total.

How to solve

In a full 5-ary tree, each internal node has 5 children. Let's denote the number of levels in the tree as h.

At each level, the number of nodes is given by the formula
5^h.

If we have 37 internal nodes, then the total number of nodes in the tree can be expressed as:

Total nodes =
(5^(h+1) - 1) / 4

We know that there are 37 internal nodes, so we can set up an equation:

37 =
(5^(h+1) - 1) / 4

Solving for h, we get:

h = 4

Now that we know the height of the tree, we can calculate the total number of nodes:

Total nodes =
(5^(4+1) - 1) / 4 = 381

Therefore, a full 5-ary tree with 37 internal nodes has 381 nodes in total.

User Mghie
by
7.2k points