Find the diameter of binary tree.
What is diameter or width of binary tree? The longest distance between two leaf nodes in binary tree provides us the diameter of binary tree. Let us take the couple of examples.
The example tree is as follows:
-------------------------------------100----------------------Level 0------
-------------------------------50----------------150----------Level 1------
---------------------------25------80 -------125 -------160---Level 3------
------------------------10 --30 --60 --90 --110 --140---------Level 4------
Diameter of Binary Tree is : 7