Driver code
public static void main ( String [ ] args ) { res = Integer . MAX_VALUE ; int [ ] vertex = { 4 , 2 , 1 , 6 , 3 , 5 , 2 } ; int [ ] [ ] edges = { { 0 , 1 } , { 0 , 2 } , { 0 , 3 } , { 2 , 4 } , { 2 , 5 } , { 3 , 6 } } ; int N = vertex . length ; System . out . println ( getMinSubtreeSumDifference ( vertex , edges , N ) ) ; } }