1.                  Write a function that will merge the contents of two sorted(ascending order) arrays of type double values, storing the resultin an array output parameter (still in ascending order). Thefunction should not assume that both its input parameter arrays arethe same length but can assume that one array does not contain twocopies of the same value. The result array should also contain noduplicate values. As an example, the two arrays and the resultingmerged array may look like the following:

First array:

Second array:

Merged array:

-10.5

-1.8

3.1

3.5

6.3

7.2

Note: when one of the input arrays has been exhausted, do notforget to copy the remaining data in the other array into theresult array. Test your function with cases in which (1) the firstarray is exhausted first, and (2) the second array is exhaustedfirst. Remember that the arrays input to this function must alreadybe sorted.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *