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