Find the smallest element greater than ar2 [ i ] . Move all elements one position ahead till the smallest greater element is not found
let j , last = arr1 [ m - 1 ] ; for ( j = m - 2 ; j >= 0 && arr1 [ j ] > arr2 [ i ] ; j -- ) arr1 [ j + 1 ] = arr1 [ j ] ;