Constructing tree given in the above figure
root = newNode ( 3 ) ; root -> left = newNode ( 2 ) ; root -> right = newNode ( 5 ) ; root -> left -> left = newNode ( 1 ) ; root -> left -> right = newNode ( 4 ) ; for ( x = 1 ; x <= 5 ; x ++ ) { int level = getLevel ( root , x ) ; if ( level ) cout << " Level ▁ of ▁ " << x << " ▁ is ▁ " << getLevel ( root , x ) << endl ; else cout << x << " is ▁ not ▁ present ▁ in ▁ tree " << endl ; } getchar ( ) ; return 0 ; }