Write a function that returns the depth/height of a binary tree.
Difficulty level
This exercise is mostly suitable for students
int height(Btree B)
{
if(!B) return 0;
return 1+ max(height(B->left), height(B->right));
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Set of integer in binary search trees