The diameter of a tree (sometimes called the width) is the number of nodes on the longest path between two leaves in the tree.
The diameter of a tree T is the largest of the following quantities:
- the diameter of T 's left subtree
- the diameter of T 's right subtree
- the longest path between leaves that goes through the root of T (this can be computed from the heights of the subtrees of T )