Introduction
This is the fifth article in the Tree Traversals - Online Classes.
A very interesting problem is to find the diameter of a tree. The challenge is not in coding the algorithm but in understanding the meaning of the problem. We will try to define the problem so that visualizing the solution becomes easy.
Defining the problem - Tree Diameter
Few confusions about the diameter must be avoided before we start.
The tree diameter is always the distance between two leaf nodes
The diameter may or may not pass through the root.
The diameter can also lie on one of the two sides,...

Read More