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 / ninad
public int check(int a[], int b[])
{
int x;
int[] c=new int[a.length];
for(int i=0; i<=c.length; i++)
{
c[i]=0;
}
for(int i=0; i<=a.length; i++)
{
for(int j=0; j<b.length; j++)
{
if(a[i]==b[j])
c[i]=1;
}
}
for(int i=0;i<=c.length;i++)
if(c[i]==0)
x=a[i];
return x;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
how to use C++?
To modify an, existing worksheet. What steps are involved for: 1. Inserting and deleting rows and columns. 2. Printing cell formulas 3Jld displayed values 3. Using the page setup command
What are the symptoms of stl?
What is a standard template library (stl)?
What is stl in oop?
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
How stl is different from the c++ standard library?
write a program to convert a decimal number in to its equivalent binary number?
write a program that will accept a number and print.its equivalent in words the maximum input number is 9999
How do you convert stl to steps?
Is there any error below, its a code to delete all entires from a map #include
What do stl stand for?
How is stl different from c++ standard library?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
What is the use of stl?