Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how can u do connectivity in c++ language? plz send me connectivity code in c++ ?

2283


How does an stl file work?

1104


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

2216


In what scenario does the Logical file and Physical file being used?

2786


What is stl stack?

1077


Is stl part of c++ standard?

1044


What do stl stand for?

1076


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.

2412


Is stl open source?

1095


How stl is different from the c++ standard library?

1158


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

2192


Can we use stl in coding interviews?

1758


How connect plc and pc through software

2422


What is the stl, standard template library?

1054


What is a list in c++ stl?

1129