Computer Science, asked by gauravjain4595, 11 months ago

How many nodes does a complete binary tree with n leaves contains?

Answers

Answered by Ujjwal2018
1

A complete binary tree is defined as a tree where each node has either 2 or 0 children.

A variety of sources have described the relation between nodes and leaves to be 2n−1 where n is the number of leaves. I haven't however been able to find a description of how this relation was derived.

☺☺ Hope this will help you ☺☺

Answered by sweetysinghal7109
1

Answer:

hey mate!!

here is Ur answer

If your total number nodes are n , and i are the total number of internal nodes ,i.e., whose degrees are 1. If the tree considered is a binary tree, then this relation holds true.

If your total number nodes are n , and i are the total number of internal nodes ,i.e., whose degrees are 1. If the tree considered is a binary tree, then this relation holds true.2i + 3 = n. Root and leaf nodes are not internal nodes. Hence, 2i + 3 = 1 + i + l where l is number of leaf nodes. This gives us, i + 2 = l. and we know that i = (n-3)/2. Hence, l = (n+1)/2.

Hope this helps..

#shruti

Similar questions