Diameter of binary tree

how only the function this.diamerter can give the length of path between two nodes

this can done by maintaining the height of tree at each node
so just maintain the height and diameter at each node

so we dont need any method to find the height

hope this will help u
pls rate my work

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.