Give two integer arrays A & B.A has n elements and B has ' n-1 ' elements . A has all the elements that are there in B. But B has one missing element. Write a function that takes arrays , A & B as imnput and finds the missing element in most optised manner .

Answer Posted / aniruddha

public int check(int a[], int b[])
{  int value,w;
   for(int i=0; i<=a.length; i++)
   {  w=0;
      for(int j=0; j<b.length; j++)
      {  
         if(a[i]!=b[j])
         {  w++;
            break;
         }
      }
      if(w==0)
      value=a[i];
   }
   return value;
}

Is This Answer Correct ?    12 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stl language?

682


If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2. please answer my question ....

1780


What is a stl vector?

628


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1978


Name the different types of stl containers.

695






What are stl algorithms?

628


What are the different types of stl containers?

652


draw a flowchart that accepts two numbers and checks if the first is divisible by the second.

2866


sir please send me bpcl previous question papers

1961


What does stl mean in slang?

654


Who created stl?

658


How do I convert a stl file?

570


Define stl.

780


totoo po ba ang manga aliens!

2343


please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html

1778