Let us construct the Tree shown in the above figure
root = newNode ( 3 ) NEW_LINE root . left = newNode ( 2 ) NEW_LINE root . right = newNode ( 5 ) NEW_LINE root . left . left = newNode ( 1 ) NEW_LINE root . left . right = newNode ( 4 ) NEW_LINE for x in range ( 1 , 6 ) : NEW_LINE INDENT level = getLevel ( root , x ) NEW_LINE if ( level ) : NEW_LINE INDENT print ( " Level ▁ of " , x , " is " , getLevel ( root , x ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( x , " is ▁ not ▁ present ▁ in ▁ tree " ) NEW_LINE DEDENT DEDENT