If element of array a is smaller than that of array b , swap them .
for ( i = 0 , j = n - 1 ; i < k ; i ++ , j -- ) { if ( a [ i ] < b [ j ] ) { let temp = a [ i ] ; a [ i ] = b [ j ] ; b [ j ] = temp ; } else break ; }