Function to reverse the subarray
static void reverse ( int left , int right , long arr [ ] ) { while ( left < right ) { long temp = arr [ left ] ; arr [ left ] = arr [ right ] ; arr [ right ] = temp ; ++ left ; -- right ; } }