You have been given root of a binary tree (not necessarily complete binary tree). Write a C++ program to compute the height of the given binary tree. code example
Example: height of a binary tree
int height(Node* root)
{
// Base case: empty tree has height 0
if (root == nullptr)
return 0;
// recur for left and right subtree and consider maximum depth
return 1 + max(height(root->left), height(root->right));
}