Are the two arrays guaranteed to be sorted before you merge them?

If not, you can either sort each array separately and then merge them, or merge the two arrays and then sort them. There's not...