Diameter of binary tree is length of longest path between any two nodes in a tree.

This path may or may not pass through the root. The diameter of binary tree can be

calculated using only height function, because the diameter of binary tree is nothing

but the maximum value of (left_height+right_height+1)for each node.

So we need to calculate this value.

>>>

Diameter is 4

>>>

## Comments