cpp implementation of Merge Sorted Array