SQL
April 23, 2024Question 243 – Binary-Trees
April 23, 2024Question 1872 – Binary-Trees
In a full binary tree of height 10, the number of nodes with degree 0,1, and 2 will be ____,____ and ____ respectively.
Note: Consider height of a tree as the number of nodes in the longest path from root to any leaf node
Correct Answer: A
Question 97 Explanation:
→ Height of the full binary tree 2h -1.
Full binary tree consists of either 0 or 2 childs . So one child to the node is not possible.
The number of nodes with the degree of 1 is 0.
The nodes with degree 0 are leaf nodes, 2h-1 = 29 = 512.
The nodes with degree 2 are internal nodes 2h-1 – 1 = 511.
Full binary tree consists of either 0 or 2 childs . So one child to the node is not possible.
The number of nodes with the degree of 1 is 0.
The nodes with degree 0 are leaf nodes, 2h-1 = 29 = 512.
The nodes with degree 2 are internal nodes 2h-1 – 1 = 511.
512, 0, 511
512, 1, 510
511, 0, 512
511, 1, 511
Subscribe
Login
0 Comments