How do we find the diameter of a Binary tree?
I have come to below algorithm. Please let me know if it works
(1)Use BFS on root's left subtree to find the last processed node say node1.
(2)Use BFS on root's right subtree to find the last processed node say node 2.
(3)Now we again run BFS from node1 as source and we keep counting the number of nodes that appear before our node2 appears. This count will give us the diameter.