Tree Algorithms
Finding Diameter of Tree
You can get the diameter of the tree by performing 2 DFS.
You can also just try post-order traversal, like what they do here.
In CS341, we learned a Divide-and-Conquer way of approaching this problem.
Search
You can get the diameter of the tree by performing 2 DFS.
You can also just try post-order traversal, like what they do here.
In CS341, we learned a Divide-and-Conquer way of approaching this problem.