Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6· (7pt.) You are a sometime-mad scientist who works in. genetics lab, Your lmes

ID: 3858508 • Letter: 6

Question

6· (7pt.) You are a sometime-mad scientist who works in. genetics lab, Your lmest experiment involes creating temifying hybrids od various animals, which brings up the problem of what you should name these hybrids. You decide that you'll just name each hy beid by combining the names of the two species used in its creation For examgle, combining a chicken and a bear would produce a chickenbear, as shown in this racher rather majesse photo. (There'sls asquimelfox in the comer) You have two aays of strings that stone the animals to be ocmbined together. Write a method that takes two amays of String values named a and b as and returns anoder anay that coatuns the concatenated alq and blk] values. For cu ie, if . "chicken" slo"squimel", "eel) and b ("bear" "owl" ox"condor"),then calling your method with arguments a and b should return the array "chickenbear", "slothou "squimelfox" eelcondor"). You can assume that a and b are always the same length (9 pts) Suppose you have the following two armrays intI x , 2, intlly-(, 2, 3) a. 2 pts) Briefty explain why xy evaluates to false. named a and b as parameters and 7pts) Write a method that takes two arrays of int values returns whether a and b are "equivalent." They should be considered equivalent if they are of the same length and contain the same elements in the same order b. 0) Who's your favorite villain and why?

Explanation / Answer

Answer) int[] x={1,2,3}

int[] y={1,2,3}

x==y is true they are equal array.

b)



#include<bits/stdc++.h>
using namespace std;



bool find(int a[], int b[],int sizea,int sizeb)
{

   
   // array are not equal
   if (sizea != sizeb)
       return false;

   // Sort both arrays
   sort(a, a+sizea);
   sort(b, b+sizeb);


   for (int i=0; i<sizea; i++)
       if (a[i] != b[i])
           return false;

   
   return true;
}


int main()
{
   int a[] = { 1, 5, 10, 5, 2};
   int b[] = { 4, 3, 5, 8, 2};
   int sizea = sizeof(a)/sizeof(int);
   int sizeb = sizeof(b)/sizeof(int);

   if (find(a, b,sizea,sizeb))
       cout << "Yes";
   else
       cout << "No";
   return 0;
}


program to check the equivalency of arrays