Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a function that will merge the contents of two sorted(ascending order)

ID: 3617745 • Letter: 1

Question

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:

-10.5

-1.8

3.5

6.3

7.2

Second array:

-1.8

3.1

6.3

empty

empty

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.

-10.5

-1.8

3.5

6.3

7.2

Explanation / Answer

please rate - thanks #include #include int merge(double[], int , double[], int , double[] ); int fill(double[], int, double[],int,int); void print(double[],int,char[]); int main() {doubleL[]={-10.5,-1.8,3.5,6.3,7.2},M[]={-1.8,3.1,6.3},res[50]; int lsize=5,msize=3,rsize=0; rsize=merge(L,lsize,M, msize,res); print(L,lsize,"Original Array 1"); print(M,msize,"Original Array 2"); print(res,rsize,"Merged Array"); getch(); return 0; } void print(double A[], int len,char mess[]) {int i; printf("%s ",mess); for(i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote