I would like to create a sorted array from a variable number of pre-sorted arrays.
Given {A1, ..., An}
which are pre-sorted arrays, I would like to create At
, which is the combination of {A1, ..., An}
and is sorted in the same way.
Example :
Given :
A1 = [2, 4, 9, 16]
A2 = [-3, 4, 98, 116]
...
An = [1, 7, 17, 76, 512]
I would like :
At = [-3, 1, 2, 4, 4, 9, 16, 17, 76, 98, 116, 512]
What it is the most efficient way to compute this array ?
Thanks