Table of Contents

    Level and Height of a Tree: Explained with Examples

    Level can be represent in two ways

    1. Level start with 0 from root nodebinary tree
    2. Level start with 1 from root node binary tree

    Level start with 0 from root node

    The maximum number of nodes on level i of a binary tree is 2i , i>=0

    binary tree

    Level start with 1 from root node

    The maximum number of nodes on level i of a binary tree is 2i-1 , i>=1

    binary tree

    Depth can be represent in two ways

    1. Depth start with 0 from root node binary tree
    2. Depth start with 1 from root node binary tree

    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

    binary tree depth of the tree

    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

    binary tree depth of the tree

    Height Example

    1. Height start with 0 from root node binary tree height of the tree