14.2 Merge two sorted arrays

#1

[EPIJ v 1.6.1]

The arrays used for illustration have no entries that appear in both sorted arrays, but it’s not explicitly stated that this will always be the case.

As such, this should be considered a valid test case: array1: <1,2>, array2: <1,2>. Note there are no empty spaces at the end of either array - because they won’t be needed for merging.

Not a big deal, but it might be of benefit to some for the problem to be explicit about this aspect of the arrays, as it affects a solution, albeit only slightly.

0 Likes

#2

In fact, the merging here does not mean de-dup so for the case you mentioned, it shall be <1, 1, 2, 2> as the output.

0 Likes

#3

Oh, interesting! I’m glad I asked. Thanks!

0 Likes