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
Write and test a program that computes the area of a circle. This program should request a number representing a radius as input
Alla [95]

The program that computes the area of a circle is represented as follows:

x = int(input("Write the length of the radius of the circle: "))

area = 3.14 * x**2

print(area)

The code is written in python

<h3>Code explanation:</h3>
  • The first line of code ask the user to input the length of the radius. The variable x is used to store the user's input.
  • The variable "area" is used to store the arithmetic manipulation of area of a circle.
  • Then, we print the variable "area". This will print the actual area of the circle with the particular radius you inputted.

learn more on python program: brainly.com/question/16398286?referrer=searchResults

6 0
2 years ago
The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
Vaselesa [24]

Correct Question:

A small company is requesting a quote to refresh its wireless network. The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future. The requirements state that the chosen solution should significantly decrease the management overhead of the current wireless network. Which of the following should the vendors recommend In response to the quote request?

A. The use of lightweight APs with a load balancer

B. The use of autonomous APs with a wireless controller

C. The use of autonomous APs with a load balancer

D. The use of lightweight APs with a wireless controller

Answer:

B.

Explanation:

Because company requires less management overheed. So an autonomous APs with a wireless controller will do the work.

3 0
3 years ago
Steve left his computer switched on in his room and went out to have breakfast. When he returned, he saw that the monitor had be
yanalaym [24]

Answer:

B

Explanation:

5 0
4 years ago
A network with 10 bits remaining for the host portion will have how many usable host addresses?
makvit [3.9K]

Answer:

2^10 = 1024 addresses

Explanation:

Each bit can be either 1 or 0, and this holds true for all 10 bits. So for every bit, we choose either a 0 or a 1 (2 choices), and then do so for the remaining bits. So we have 2 * 2 * 2 * ... * 2 (10 2's) choices for all 10 bits

8 0
3 years ago
Explain different types of secondary memory of computer system<br>​
Westkost [7]

<em>Answer:</em>

<em>There are three main types of secondary storage in a computer system: solid state storage devices, such as USB memory sticks. optical storage devices, such as CD, DVD and Blu-ray discs. magnetic storage devices, such as hard disk drives.</em>

<em>Explanation:</em>

6 0
2 years ago
Other questions:
  • A network engineer arrives at work and discovers that many users are having problems when attempting to connect to the company n
    9·2 answers
  • Life can get busy and hectic but relationships matter what is an effective way to mending relationships that may have been negle
    9·1 answer
  • Robert is leading a project online that includes students from different cultures. Two of the students spend most of the time li
    7·1 answer
  • What information may be obtained from a ResultSetMetaData object?(TCOs 1–6) What information may be obtained from a ResultSetMet
    9·1 answer
  • The software maintains and manages information related to employees, rooms, committees, and committee meetings of a company. The
    9·1 answer
  • an individual’s Body Mass Index (BMI) is a measure of a person’s weight in relation to their height. it is calculated as follows
    6·1 answer
  • Which graphic file format would you choose if you needed to make an animated graphic for a website?
    5·1 answer
  • In computing, what does LAN stand for?​
    13·2 answers
  • "You have created a Word document named apple.docx using Microsoft Word. What type of a file is apple.docx ? Select all that app
    14·1 answer
  • which one of the following would not normally be found in an organization's information security policy?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!