Write a C program to compute the depth of a binary tree?
maxDepth function would take root node as the input and return the depth of the tree. Its the recursive programming solution to find the depth of the tree
int maxDepth(struct node* node)
{
if (node==NULL)
{
return(0);
}
else
{
int leftDepth = maxDepth(node->left);
int rightDepth = maxDepth(node->right);
if (leftDepth > rightDepth) return(leftDepth+1);
else return(rightDepth+1);
}
}
