Infosys interview question

sorting an array and merging an array