Description: The height of a tree is given by the number of nodes on the longest path from the root to the leaf. Given a tree, we have to find it’s height.
The tree given below has a height of 3.
/*The following function is used to find height of the tree or portion of the tree recursively*/
int height(struct node* node)
return 0;/*tree is empty*/
int left_height = height(node->left); /*height of left subtree*/
int right_height = height(node->right);/*height of right subtree*/
if (left_height > right_height)