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...


write a program for finding the union of two integer array
in java?

Answers were Sorted based on User's Feedback



write a program for finding the union of two integer array in java?..

Answer / satish kumar

void union(int x[],int y[])
{


int n=x.length + y.length ;
int z[]=new int[n];
int p=x.length;
for(int i=0;i<x.length;i++)
{
z[i]=x[i];
}
int j=0;
for(int i=0;i<y.length;i++)
{
for(j=0;j<x.length;j++)
{
if(y[i]!=z[j])
{
continue;
}
else
{
if(y[i]==z[j])

break;
}
}
if(j==x.length)
z[p++]=y[i];
}

Is This Answer Correct ?    32 Yes 24 No

write a program for finding the union of two integer array in java?..

Answer / nadeem khokhar

the above mentioned code is also good one. but i m giving you an algorithm you can say, so you can get the concept and convert it into any language
int a[3]=1,2,3;
int b[3]=2,3,4;

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

for(int j=0; j<=2; j++)
{

if(a[i] == b[j])
cout<<a[i]; is a union of a and b
}
}

Is This Answer Correct ?    14 Yes 26 No

Post New Answer

More Programming Languages AllOther Interview Questions

what is the use MDM(Master Data Management)and meaning

0 Answers  


Write a program to reverse a number?

0 Answers   BirlaSoft,


1. What coding languages are you comfortable with?

1 Answers  


how to generate dsnless connectivity in j2ee

0 Answers  


how do i create my own exception class which will restrict IO exception?

0 Answers  


Display names and numbers of employees who have 5 years or more experience and  salary less than Rs.15000 using array of structures (name, number, experience and  salary)

0 Answers  


what is meant by trigger?

8 Answers   IBM,


What is a programming language?

1 Answers  


I am looking for selenium RC online Training in chennai. can any one tell me the best institute

0 Answers  


Explain recursion with an example.

1 Answers  


When you deliver your C++ headers and C++ library of a class (what all can you change in the class so that application using your class does not need to recompile the code)

0 Answers   Yahoo,


how do u handle table control inbdc explain the process in steps iwant the answer in urgent please forward this even i know how to explain there

0 Answers   Synopsis,


Categories