What Is Height/Depth Of A Binary Tree?
A binary tree of height h ( > 0 ), has at least h elements and at most (2^h -1) elements in it.
C Program Code To Find Height/Depth Of a Tree:
int binary_tree_height ( mynode *p )
{if ( p == NULL )
return ( 0 );
if ( p->left )
h1 = binary_tree_height ( p->left );
if ( p->right )
h2 = binary_tree_height ( p->right );
return ( max ( h1, h2 ) + 1 );
}
When You invoke this recursive function, it will return height/depth of a binary tree.