Recursive function that calculate the value of the cost of splitting the tree recursively
void findCost ( int r , int p , int arr [ ] ) { int i , cur ; for ( i = 0 ; i < edges [ r ] . size ( ) ; i ++ ) {