Question: C++ programming Implement the following function: void make DifferenceArray(int* srtArr1, int n1, int* srtArr2, int n2, int* & out DifferenceArr, int& outN) This function
C++ programming Implement the following function: void make DifferenceArray(int* srtArr1, int n1, int* srtArr2, int n2, int* & out DifferenceArr, int& outN) This function takes two base addresses of arrays of integers: srtArr1 and srtArr2, and their respective logical sizes: n1 and n2. The elements in each array come in a sorted (strictly ascending) order. When called, it should create an array, containing all the numbers that are in srtArr1 and not in srtArr2. This array should be returned by using the two output parameters: out DifferenceArr and outN to update the base address of the created array, and its logical size. Note that these output parameters use call by reference (not pointers) to update the values in the scope of the caller of the function. For example, if srtArr1=[1, 2, 3, 5, 7, 8], and srtArr2=[2, 5, 6, 9], the call to makeDifferenceArray with these two arrays, should create the array [1, 3, 7, 8] and use the output parameters to return its base address and its logical size. Runtime requirement: Your function should run in worst-case linear time (O(n" + n!)). Implementation requirements: 1. You must implement the function with the prototype as given above. That is, you are not allowed to change the header line of the function. 2. The function should not change the contents of its input arrays.
Step by Step Solution
There are 3 Steps involved in it
Heres a C implementation of the makeDifferenceArray function that creates an array containing number... View full answer
Get step-by-step solutions from verified subject matter experts
