Untill i less than equal to k or j is less tha m
while ( i <= k and j < m ) { if ( arr1 [ i ] < arr2 [ j ] ) i ++ ; else { int temp = arr2 [ j ] ; arr2 [ j ] = arr1 [ k ] ; arr1 [ k ] = temp ; j ++ ; k -- ; } }