write a program for finding the union of two integer array
in java?
Answers were Sorted based on User's Feedback
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 |
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 |
Tell me the jobs for the MCA Fresher in delhi, Noida..
is possible to delete specific data in a row by using of sql query?
what is polymorphism in java.
3 members in a pf.how we read 3 members without using ovrdbf.using rg pgms....
When we delete logfiles such as screenshots how does it affect the ldf file? Ive seen huge change while adding screenshots in the ldf file but a very minor one deleting them.Please Explain
Artficial language is provided which of the language?
Write a shell program to test whether a given year is leap year or not ?
what do u mean by html
how sap is different from other software ?
What are the other ways to create an object with out calling new keyword in java?
what is the similarity between networking devices?
what is meant by trigger?