Iterate the array to find the maximum and minimum element
for ( int i = 1 ; i < n ; i ++ ) { int x = v [ i ] ; if ( x < low ) { low = x ; pos_low = i ; } else if ( x > high ) { high = x ; pos_high = i ; } }