Level and Height of the tree
Table of Content:
Level can be represent in two ways
- Level start with 0 from root node
- Level start with 1 from root node
Level start with 0 from root node
The maximum number of nodes on level i of a binary tree is 2i , i>=0
Level start with 1 from root node
The maximum number of nodes on level i of a binary tree is 2i-1 , i>=1
Depth can be represent in two ways
- Depth start with 0 from root node
- Depth start with 1 from root node
Depth start with 0 from root node
The maximum number of nodes in a binary tree of depth k is 2(k+1) - 1 where k >= 0
Depth start with 1 from root node
The maximum number of nodes in a binary tree of depth k is 2k-1 where k >= 0
Height Example
- Height start with 0 from root node