title: A linear-time algorithm for finding the longest distance between two nodes in a free tree?
body: <p>Given a free tree, find an algorithm to find the longest path between two nodes that runs in linear time.  Is this possible to do if the nodes don't store their level? If yes, how?</p>
  
  <p>If the nodes do store their level then I would move the lower node up the tree to the same level as the other. Than I would keep moving up the tree until the nodes overlap. The distance would be the sum of each time a node was moved up the tree.</p>