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]
4 years ago
12

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

Computers and Technology
1 answer:
avanturin [10]4 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
Suppose we are comparing the implementations of insertion sort and merge sort on the same machine(You don’t need to know the alg
Anuta_ua [19.1K]

Answer:

123456789o0

Explanation:

4 0
3 years ago
You’re investigating an internal policy violation when you find an e-mail about a serious assault for which a police report need
Rasek [7]

The email specifying who in your company you need to talk to first and what evidence must be turned over to the police is written below.

The manager,

Robotics Plc.

Dear sir,

<h3>Issue of  internal policy violation</h3>

I wish to bring to your notice an issue of concern that has occurred in the company. All employees are mandated to work for the growth of the company and when things or due protocol are not being followed, it can bring an organization down.

I wish to bring to your notice an issue of  internal policy violation  that was done by Mr. Yusuf Thomas on December 2021 that has cost the company to loss about 2million dollars. He used the companies money and also took some of the companies client for himself.

He is still working and no sanction or steps have been taken to reprimand him. I wish that the issue be solved so that others will not follow the same steps.

Thanks and waiting for quick response.

Mary Gina.

Learn more about policy violation from

brainly.com/question/13198827

#SPJ1

6 0
2 years ago
Master controller for all activities that take place within a computer; primary purpose is to help the computer system monitor i
Ray Of Light [21]

Answer:

Operating System

Explanation:

Master controller for all activities that take place within a computer; primary purpose is to help the computer system monitor itself in order to function efficiently

8 0
3 years ago
Read 2 more answers
When you point to defined styles in the cell styles gallery, you can see the formatting that will be used when you apply each st
Dvinal [7]
Hello  <span>Missthang2456 </span>

Question: <span>When you point to defined styles in the cell styles gallery, you can see the formatting that will be used when you apply each style?


Answer: This is true

Hope This Helps!
-Chris</span>
4 0
3 years ago
Características que debe tener un módulo o kit tecnológico para aprender​
12345 [234]

Answer:

Multi herramientas

Explanation:

Un kit tecnologico debe contener todas las herramientas necesarias para el trabajo que lo necesites, por ejemplo destornillador magnetico con varias puntas, herramientas para desmontar y por supuesto tener buena claridad para trabajar y alcohol isoprofilico de al menos 90+ para limpiar electronicos.

5 0
3 years ago
Other questions:
  • Which type of multiplexing divides transmission opportunities into slots of 125 microseconds with position inside each slot rese
    10·1 answer
  • Which command on the page layout ribbon enables a user to mark where a new page will begin on the printed copy?
    6·1 answer
  • (tco 3) what vbscript boolean operator could be used to replace the nested selection structure in this pseudocode? if empmedical
    13·1 answer
  • 2. How do web bugs invade a person’s privacy?
    10·2 answers
  • You have installed five new 300 GB disk drives into a server running Windows Server 2012. You want to create a volume that will
    15·1 answer
  • 2.3 Code Practice: Question 3
    14·1 answer
  • 5. Write<br>the<br>steps.<br>open<br>MS-<br>powerpoin<br>to<br>​
    11·1 answer
  • pharmaceutical company is using blockchain to manage their supply chain. Some of their drugs must be stored at a lower temperatu
    5·2 answers
  • Human services organizations seek to make changes and help people in need to improve their .
    9·1 answer
  • PLEASE HURRY!!<br> Look at the image below
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!