Function to find the diameter of the tree using Dynamic Programming
public static void dfs ( int node , int parent , int [ ] dp1 , int [ ] dp2 , ArrayList [ ] adj , int [ ] tree ) { int sum1 = 0 , sum2 = 0 ;