C++ programming Implement the following function: void make DifferenceArray(int* srtArr1, int n1, int* srtArr2, int n2,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Heres a C implementation of the makeDifferenceArray function that creates an array containing number... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these algorithms questions
-
What considerations are important when implementing a sustainability-focused process technology strategy for Company?
-
The file survey.mtw contains selected variables from an online survey of ADM 2304 students. Assume that these results represent a random sample of all Telfer undergraduate students. The variables are...
-
A registered dealer, based in Chandigarh, makes a supply to another registered dealer located in Chandigarh, valuing rupees 1,20,000. The applicable rate of GST is 12%. Calculate the amount of tax...
-
Consider the following. (a) Find aw s aw at (b) Find aw s w at w = x cos(yz), x = s, y = t, z =s - 2t aw aw by using the appropriate Chain Rule. (Enter your answers in terms of s and t.) s at aw s...
-
Suzanne owns a vacation home at the beach in which she lived for 30 days and rented out for 61 days during the current year. Her gross rental income is $2,600. Her total expenses for the vacation...
-
(A) Construct a set of five numbers that has mean 200, median 150, and mode 50. (B) Let m 1 > m 2 > m 3 . Devise and discuss a procedure for constructing a set of five numbers that has mean m 1 ,...
-
Question: You are the CEO of a software company. You will only allow your engineers to create software for Apple computers, not for PCs because you think Apple is cooler and you hate Microsoft. Some...
-
Preparing a Bank Reconciliation and Related Journal Entries The bookkeeper at Wood Company has not reconciled the bank statement with the Cash account, saying, I dont have time. You have been asked...
-
10. Write down second-order linear equations of the form Ay" + By + Cy = q(t) that are solved by the following functions: (a) y(t) = ce+c2e-2 + e-3 (b) y(t)=c+ce + te
-
McKinney Solvents produces a wide variety of products for the manufacturing industry. The standard mix for producing a single batch of 100 gallons of its biggest-selling product is as follows: There...
-
Write the program in C. Create your own fgets() and fputs() using only Unix system calls such as open, read, write, close etc, so no standard input/outputs functions are allowed. Using only the Unix...
-
Reed, CPA, accepted an engagement to audit the financial statements of Smith Company. Reed's discussions with Smith's new management and the predecessor auditor indicated the possibility that Smith's...
-
Circumstances may necessitate a departure from the auditor's standard report. Required a. Indicate the two types of departures from the auditor's standard report. b. Indicate the effects on the...
-
Indicate the alternative circumstances and effects on the auditor's report when the auditor concludes there is substantial doubt about the entity's ability to continue as a going concern for a...
-
a. What is the meaning of the term "practice of public accounting?" b. What is the meaning of the term "holding out?"
-
What are the responsibilities of the AICPA's Professional Ethics Division?
-
You are given the following cash flow information for Project A: Project A PV Outflows $150,000.00 TV Inflows Year 0 -$150,000.00 1 $80,000.00 2 -$25,000.00 3 $50,000.00 4 $80,000.00 5 -$30,000.00 6...
-
(a) What do data breach notification laws require? (b) Why has this caused companies to think more about security?
-
In this exercise, you will create a program that displays the amount of a cable bill. The amount is based on the type of customer, as shown in Figure 10-30. For a residential customer, the user will...
-
Write the C++ code that uses the substr function to determine whether the string stored in the rate variable ends with the percent sign. If it does, the code should use the replace function to remove...
-
If the cities and zips arrays are parallel arrays, which of the following statements will display the city name associated with the zip code stored in the zips[8] variable? a. cout < <...
-
9. Advertisements for Listerine mouthwash claimed that it was as effective as flossing in preventing tooth plaque and gum disease. This statement was true, but only if the flossing was done...
-
10. Check Enforcement Unit, Inc. (CEU), was in the business of helping merchants collect on bad checks. When a merchant received a dishonored check, it would forward the check directly to CEU, which...
-
11. ROLE REVERSAL Prepare a short-answer question that focuses on deceptive advertisements. Include a sample ad in the question (either a real ad or one that you have made up).
Study smarter with the SolutionInn App