1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xxTIMURxx [149]
3 years ago
12

Finish and test the following two functions append and merge in the skeleton file:

Computers and Technology
1 answer:
avanturin [10]3 years ago
4 0

Answer:

Explanation:

#include <iostream>

using namespace std;

int* append(int*,int,int*,int);

int* merge(int*,int,int*,int);

void print(int*,int);

int main()

{ int a[] = {11,33,55,77,99};

int b[] = {22,44,66,88};

print(a,5);

print(b,4);

int* c = append(a,5,b,4); // c points to the appended array=

print(c,9);

int* d = merge(a,5,b,4);

print(d,9);

}

void print(int* a, int n)

{ cout << "{" << a[0];

for (int i=1; i<n; i++)

cout << "," << a[i];

cout << "}\n";

}

int* append(int* a, int m, int* b, int n)

{

int * p= (int *)malloc(sizeof(int)*(m+n));

int i,index=0;

for(i=0;i<m;i++)

p[index++]=a[i];

for(i=0;i<n;i++)

p[index++]=b[i];

return p;

}

int* merge(int* a, int m, int* b, int n)

{

int i, j, k;

j = k = 0;

int *mergeRes = (int *)malloc(sizeof(int)*(m+n));

for (i = 0; i < m + n;) {

if (j < m && k < n) {

if (a[j] < b[k]) {

mergeRes[i] = a[j];

j++;

}

else {

mergeRes[i] = b[k];

k++;

}

i++;

}

// copying remaining elements from the b

else if (j == m) {

for (; i < m + n;) {

mergeRes[i] = b[k];

k++;

i++;

}

}

// copying remaining elements from the a

else {

for (; i < m + n;) {

mergeRes[i] = a[j];

j++;

i++;

}

}

}

return mergeRes;

}

You might be interested in
3 ᴍᴜʟᴛɪᴘʟᴇ-ᴄʜᴏɪᴄᴇ Qᴜᴇꜱᴛɪᴏɴꜱ
Damm [24]
4, 1, and 3

The last one I am going to say three because I know that friends show other friends so I wouldn’t call that “private”
6 0
2 years ago
How are Action Buttons different than hyperlinks?
ipn [44]

Actions buttons are different than hyperlinks in many ways.

2)They are predefined shapes.

<u>Explanation:</u>

Action buttons are predefined shapes in the PowerPoint and can be used for moving between the slides of the presentation and for referring to the hyperlinks as well.

Action buttons have a predefined shape and that shape can be used to set the functionality of that particular button as a convention. Action buttons make up a strong presentation.

Action buttons can be invoked by clicking on them or just hovering over them and various sound effects can also be added on both the events to make the presentation more engaging and attractive.

8 0
2 years ago
The default setting for a secondary zone's refresh interval is how many minutes
Vinil7 [7]
The default value at which a refresh interval (an interval a sec. server check for zone updates) is 15 minutes.
If this value is increased, the network traffic is reduced. In the eventuality that the refresh interval expires, the secondary zone will contact the primary zone and request it to initiate the zone transfer.
4 0
3 years ago
1. Describe how research and development influence design. Cite specific examples of how research and development influence desi
vladimir1956 [14]

Answer:

so i research and found this,

Development is when findings of a research are utilized for the production of specific products including materials, systems and methods. Design and development of prototypes and processes are also part of this area. Engineering is utilization of these plans and research to produce commercial products.

4 0
2 years ago
What is an example of new technology having a negative impact on sustainability?.
Sedbober [7]

An example of new technology that is having a negative impact on sustainability is using multiple servers to maintain a cryptocurrency operation.

<h3>How does technology influence sustainability?</h3>

The use of technology is one that have a lot of power to increase productivity, efficiency and cost savings, and others  but it is also known to have a negative effect on the environment.

Sustainability implies that one meets the needs of people without having to compromise the power of future posterity to meet their own needs.

Learn more about sustainability from

brainly.com/question/25350238

3 0
2 years ago
Other questions:
  • Your network employs basic authentication that centers on usernames and passwords. However, you have two ongoing problems. The f
    13·1 answer
  • List and the deference between MS access objects​
    8·1 answer
  • Marginal ________ shows how much money can be made if a producer sells one additional unit of a good.
    7·2 answers
  • Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
    5·1 answer
  • why are the ads you might see on tv between 8am and 10am usually not the same ads you would see between 8pm and 10pm?
    12·1 answer
  • 9.1.3: Printing vector elements with a for loop. Write a for loop to print all NUM_VALS elements of vector courseGrades, followi
    5·1 answer
  • Functionality testing is primarily used with ____________. firewall protection software development hardening servers server tes
    8·1 answer
  • A school has an intranet for the staff and students to use. Some of the files stored on the intranet are confidential. Give two
    15·1 answer
  • You use a Windows desktop system to edit and produce audio files. Your system has two hard disks installed. Your applications ar
    10·1 answer
  • Greg is concerned about the use of ddos attack tools against his organization, so he purchased a mitigation service from his isp
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!