Computer Science, asked by iamlall4736, 1 year ago

A full binary tree with n non leaf nodes contains how many nodes

Answers

Answered by Anonymous
0
================  HEYA THERE ===================



----------------  HERE IS A ANSWER -----------------------------


A full binary tree with n non leaf nodes contains 6 NODES



__________________________



#  BRAINLY2222 


@ COMPUTER SCIENCE 
Answered by gauravy
2

Answer:

2n +1

Explanation:

A complete binary tree is one in which all levels except those in last level are fully filled and even in last level all nodes are filled from left to right.

Now, a tree is a graph and we can consider the binary tree as an undirected graph also. So, degree of root = 2, degree of all internal nodes excluding root = 3 (one parent and 2 child nodes) and degree of leaf nodes = 1 (only parent). (Assuming root is not a leaf and tree is full also).

Now, sum of degrees in a graph =2e, where e is the no. of edges.

In a tree we have e=x−1 where x is the total no. of nodes. Now, we have n non-leaf nodes, so that means x−n leaf nodes and n−1 internal nodes excluding root. So, equating the sum of degrees, we can write

2+3.(n−1)+x−n=2.(x−1)⟹x=2n+1.

Now, if tree is complete but not full, the last node might have no sibling and thus total number of nodes can be 2n also (one internal node having degree 2 instead of 3.

Similar questions