結果 : diameter of a tree algorithm