Driver code to test above methods
int main ( ) { int vertex [ ] = { 4 , 2 , 1 , 6 , 3 , 5 , 2 } ; int edges [ ] [ 2 ] = { { 0 , 1 } , { 0 , 2 } , { 0 , 3 } , { 2 , 4 } , { 2 , 5 } , { 3 , 6 } } ; int N = sizeof ( vertex ) / sizeof ( vertex [ 0 ] ) ; cout << getMinSubtreeSumDifference ( vertex , edges , N ) ; return 0 ; }