Diameter is equal to the path between the two farthest nodes leaf1 and leaf2
getDiameterPath ( leaf1 , leaf2 , - 1 , path ) ; int pathSize = path . Count ; if ( pathSize % 2 == 1 ) { Console . WriteLine ( path [ pathSize / 2 ] ) ; } else { Console . WriteLine ( path [ pathSize / 2 ] + " , ▁ " + path [ ( pathSize - 1 ) / 2 ] ) ; } }