What is a Tree Diameter?

What is a Tree Diameter?

Approach: Define the longest path between any two nodes.

The length of the longest path between any two nodes in a tree. It can be found using two BFS traversals: first to find the farthest node from an arbitrary root, and second to find the farthest node from that node.

Follow-up: Can a tree have more than one diameter?

Key concepts: longest path, bfs/dfs.