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
irga5000 [103]
3 years ago
13

Merge arrays A and B into array C using merge sort algorithm. Give final sorted numbers of C using colored numbers without showi

ng intermediate steps. For example, your answer can be [1, 3, 3, 5, 7, 7, 9, 9, 13, 25] or [1, 3, 3, 5, 7, 7, 9,9, 13, 25), or another variation. void merge(int all, int aux[], int lo, int mid, int hi) / for (int k = lo; k<= hi; k++) aux [k] a[k]; int i lo, j = mid+1; for (int k lo; k<-hi; k++) if (i > mid) ak) else if (1 > hi) a[k] else if (small (aux(j), aux[1])) a[k] else ak aux[j++); aux (i++); aux [j++); /*++ aux (i++]; 1 j++
Computers and Technology
1 answer:
sweet-ann [11.9K]3 years ago
7 0

Answer:

Explanation:

Given code:-

#include<iostream>

using namespace std; //namespace

#define RED "\033[31m" /* Red */

#define BLUE "\033[34m" /* Blue */ //color definition

#define WHITE "\033[37m" /* White */

void mergeArrays(int arr1[], int arr2[], int n1, int n2, int arr3[])

//merger sort

{

int i = 0, j = 0, k = 0;

while (i<n1 && j <n2) //iterate over both array

{

if (arr1[i] < arr2[j]) //iff array 1 element is larger

{

arr3[k] = arr1[i]; //assign to a3

k++;

i++;

}

else

{

arr3[k] = arr2[j]; //else assign array 2 to a3

j++;

k++;

}

}

//say the array turns out to br of different sizes

//let us copy the remaining elemnt to array 3

while (i < n1)

{

arr3[k] = arr1[i];

i++;

k++;

}

while (j < n2)

{

arr3[k] = arr2[j];

k++;

j++;

}

}

int main(){

int A[4] = {3,5,7,9}; //array 1 assignment

int a_size = 4;

int b_size = 6;

int B[6] = {1,3,7,9,13,25}; //array 2 assignment

int C[10]; //array 3 declearation

int a_count = 0;

int b_count = 0; //counter for both array index

mergeArrays(A,B,a_size,b_size,C); //merger function applied;

cout<<WHITE<<"A: ";

for(int i = 0; i<4; i++){

cout<<RED<<A[i]<<" ";

}

cout<<endl<<WHITE<<"B: ";

for(int i = 0; i<6; i++){

cout<<BLUE<<B[i]<<" ";

}

cout<<endl<<WHITE<<"C: ";

for(int i = 0; i<10; i++){ //iterate over C

if(C[i] == A[a_count] && a_count < a_size){

cout<<RED<<C[i]<<" ";

// if element is common in array 1 print in red

a_count++;

}

else if (C[i] == B[b_count] && b_count < b_size){

//say element was similar in array 2,  print in blue

cout<<BLUE<<C[i]<<" ";

b_count++;

}

}

cout<<endl;

}

You might be interested in
Why would you convert your birth year to binary numbers?
I am Lyosha [343]

Answer:

Write out your birthday in the following format: M/DD/YY. For example, if your birthday is on June 11, 2013, it would be written as 6/11/13.

2. Convert the birthday date to binary format. Using our same example from above, 6/11/13 translated into binary code would be: 110/1011/1101.

3. Select one color of bead to represent “0”, a second color to represent “1” and then the third color to represent a space (/) between the numbers.

4. Layout the beads to represent your birthdate in binary code. Don’t forget the third color for the spaces in between the numbers!

5. Once laid out, string all the beads on to the string or pipe cleaner.

6. Tie a knot around the ends and enjoy your one-of-a kind masterpiece as a piece of jewelry or a bag tag….the options are endless!

6 0
3 years ago
Which of the following is true about ISO___________.
Svetach [21]

Answer:

The answer is "Option d".

Explanation:

In the given question in option b and option c, there is some typing mistake, but all the options are correct.

ISO is an organization, that is based on Geneva, which is a member of Switzerland. It provides one of the major guidelines for developing entities, that provides technical suggestions on frameworks for data communication.

  • It is used to optimize products with businesses across ranges.
  • The primary aim was to facilitate trade, but in several ways, it focus on enhancing procedures, safety, and quality.
3 0
3 years ago
_______ is a process that insures that operations meet data validity standards. For instance, information systems that process c
lutik1710 [3]

Answer:

The answer is consistency

Explanation:

Information systems deal with the retrieval, storage, manipulation and sharing of data for organisational needs. It is important that there are measures in place that corresponds to data validity standards. The process that ensures that operations meet these standards is known as consistency.

This is very necessary for information systems.

5 0
3 years ago
HELP ASAP PLZ PLZ PLZTegan is playing a computer game on her smartphone and the battery is getting low. When she goes to charge
frozen [14]

Answer:

3rd choice

Explanation:

6 0
2 years ago
Complete the sentence.
Luda [366]
The answer is Tablets
6 0
3 years ago
Other questions:
  • What is going to be the shortest, most concise restatement of information?
    10·2 answers
  • Changing the user name in the word application is completed through the __.
    10·2 answers
  • What is the basic purpose of Google calendar?
    14·2 answers
  • 4+4 act quick for brainliest
    10·2 answers
  • 3-Write a program in some language that has both static and stack dynamic local variables in subprograms. Create six large (at l
    9·2 answers
  • Signing up for a(n) ____ will automatically provide you with web content that is updated on a regular basis.
    15·1 answer
  • I keep getting this error: postfix.cpp: In function ‘double RPN_evaluation(std::string)’: postfix.cpp:42:26: error: cannot conve
    7·1 answer
  • EASY POINTS what favorate food<br> so easy
    7·2 answers
  • Given the following snippet of code, answer the following two questions based on the code: typedef enum {Sun, Mon, Tue, Wed, Thu
    15·1 answer
  • Question 1 (1 point)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!