1
$\begingroup$

A ternary tree is an ordered tree where each node has either 0 or 3 children. Such a tree is full if all leaves are at the same distance from the root. Derive an explicit formula for the number of leaves, and the total number of nodes, in a full ternary tree of height h.

My idea was that At level h i.e. the number of leaf nodes in a ternary tree is 3^h.

3^(h + 1) - 1) /2  = n
(3^(h + 1) - 1)  = 2n
3^(h + 1)  = 2n + 1
3^h * 3 = 2n+1
3^h = (2n+1) /3

So the number of leaf nodes in a ternary tree of n nodes is (2n+1)/3

$\endgroup$