solution to merge sorted array: merge from the end to avoid many data moving